Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.plugin.defaults.base = 'js/jquery.';//instead of typing for each url
- $.plugin.defaults.ext = '-min.js';//same
- //registers $.scrollTo and $.fn.scrollTo
- $.plugin.register( 'scrollTo', {
- $:'scrollTo', fn:'scrollTo'
- }, {
- id:'scroll-to'//an id so other plugins can use it as dependency
- });
- //registers $.localScroll and $.fn.localScroll
- $.plugin.register( 'localScroll', {
- $:'localScroll', fn:'localScroll'
- },{
- require:'scroll-to'
- });
- //registers $.serialScroll and $.fn.serialScroll
- $.plugin.register( 'serialScroll', {
- $:'serialScroll', fn:'serialScroll'
- },{
- require:'scroll-to'
- });
- jQuery(function( $ ){
- $.plugin
- //this event is triggered when a plugin is requested
- .bind('loading', function( e, plugin ){
- $('#state').text('loading '+plugin.url);
- })
- //this event is triggered when a plugin is loaded and parsed
- .bind('loaded', function( e, plugin ){
- $('#state').text('loaded '+plugin.url);
- })
- //this call will make the plugin load scrollTo, and then localScroll
- //serialScroll is never requested, as it won't be used.
- $.localScroll();
- });
Advertisement
Add Comment
Please, Sign In to add comment