Skip to content

Instantly share code, notes, and snippets.

@inertialbit
Created January 27, 2011 20:57
Show Gist options
  • Save inertialbit/799258 to your computer and use it in GitHub Desktop.
Save inertialbit/799258 to your computer and use it in GitHub Desktop.
var Collapsible = $.klass({
initialize: function() {
this.element.find('.open').each(function(i, e) {
$(e).siblings().show();
});
this.element.find('.closed').each(function(i, e) {
$(e).siblings().hide();
});
},
onclick: $.delegate({
'.collapsible': function(clickedElement, event) {
clickedElement.siblings().toggle();
}
})
});
jQuery(function($) {
$('ul.events').attach(Collapsible);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment