Permalink
Browse files

Added jquery toggler plugin for using links to easily toggle content

  • Loading branch information...
1 parent 6a4f116 commit 4b7c457b856748d9d9bc2cbacaddde317bd78377 @jnunemaker committed Nov 18, 2008
Showing with 19 additions and 0 deletions.
  1. +19 −0 jquery.toggler.js
View
@@ -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.