engine/vendor/assets/javascripts/locomotive/menu_toggler.js

33 lines
858 B
JavaScript
Raw Normal View History

2011-11-14 09:13:58 +00:00
/**
* Version 1.0.1
* Init and deploy childs on menu (admin)
* Benjamin Athlan - Bewcultures
* Andrew Bennett - Delorum
*/
$.fn.toggleMe = function(settings) {
settings = $.extend({}, settings);
var toggle = function(event) {
var toggler = $(this);
var children = toggler.parent().find('> ul.folder');
children.each(function() {
var child = $(this);
if (child.is(':visible')) {
child.slideUp('fast', function() {
toggler.attr('src', toggler.attr('src').replace('open', 'closed'));
$.cookie(child.attr('id'), 'none');
});
} else {
child.slideDown('fast', function() {
toggler.attr('src', toggler.attr('src').replace('closed', 'open'));
$.cookie(child.attr('id'), 'block');
});
}
});
};
2012-03-23 00:29:12 +00:00
return $(this).bind('click', toggle);
2011-11-14 09:13:58 +00:00
};