Guest User

Ariel Flesler

a guest
Mar 4th, 2008
971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.plugin.defaults.base = 'js/jquery.';//instead of typing for each url
  2. $.plugin.defaults.ext = '-min.js';//same
  3.  
  4. //registers $.scrollTo and $.fn.scrollTo
  5. $.plugin.register( 'scrollTo', {
  6.     $:'scrollTo', fn:'scrollTo'
  7. }, {
  8.     id:'scroll-to'//an id so other plugins can use it as dependency
  9. });
  10.  
  11. //registers $.localScroll and $.fn.localScroll
  12. $.plugin.register( 'localScroll', {
  13.     $:'localScroll', fn:'localScroll'
  14. },{
  15.     require:'scroll-to'
  16. });
  17.  
  18. //registers $.serialScroll and $.fn.serialScroll
  19. $.plugin.register( 'serialScroll', {
  20.     $:'serialScroll', fn:'serialScroll'
  21. },{
  22.     require:'scroll-to'
  23. });
  24.  
  25. jQuery(function( $ ){
  26.     $.plugin
  27.                   //this event is triggered when a plugin is requested
  28.         .bind('loading', function( e, plugin ){
  29.             $('#state').text('loading '+plugin.url);
  30.         })
  31.                   //this event is triggered when a plugin is loaded and parsed
  32.         .bind('loaded', function( e, plugin ){
  33.             $('#state').text('loaded '+plugin.url);
  34.         })
  35.    
  36.          //this call will make the plugin load scrollTo, and then localScroll
  37.          //serialScroll is never requested, as it won't be used.
  38.     $.localScroll();   
  39. });
  40.  
Advertisement
Add Comment
Please, Sign In to add comment