DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

vincent has posted 1 posts at DZone. View Full User Profile

Jquery Plugin Template

04.03.2009
| 2864 views |
  • submit to reddit
        // basic jquery plugin template help from http://www.learningjquery.com/2007/10/a-plugin-development-pattern

//
// create closure
//
(function($){
    //
    // plugin definition
    //
    $.fn.divScroll = function(options){
        // build main options before element iteration
        var opts = $.extend({}, $.fn.divScroll.defaults, options);
        
        // iterate and reformat each matched element
        return this.each(function(){
            $this = $(this);
            
        });
    };
    
    //
    // plugin defaults
    //
    $.fn.divScroll.defaults = {};
    
    //
    // end of closure
    //
})(jQuery);