Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added jquery toggler plugin for using links to easily toggle content
  • Loading branch information
jnunemaker committed Nov 18, 2008
1 parent 6a4f116 commit 4b7c457
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jquery.toggler.js
@@ -0,0 +1,19 @@
// Example html file: http://gist.github.com/26239
(function($) {
$.fn.toggler = function(options) {

var opts = $.extend({}, $.fn.toggler.defaults, options);

return this.each(function() {
this.togglee = $($(this).attr('href')).hide();
$(this).click(onClick);
});

function onClick() {
this.togglee[opts.animate ? 'slideToggle' : 'toggle']();
return false;
}
}

$.fn.toggler.defaults = {animate: false}
})(jQuery);

0 comments on commit 4b7c457

Please sign in to comment.