public
Description: some various js files and examples for me to refer to and use
Homepage:
Clone URL: git://github.com/jnunemaker/javascripts.git
Click here to lend your support to: javascripts and make a donation at www.pledgie.com !
javascripts / jquery.toggler.js
100644 19 lines (15 sloc) 0.481 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);