/ Published in: jQuery

the plugin model in JQuery takes advantage of JavaScript’s prototype inheritance and makes it trivially easy to add new chainable methods
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
jQuery('div#message').addClass( 'borderfade' ).animate({ 'borderWidth': '+10px' }, 1000).fadeOut(); // Can be 'packaged' as: jQuery.fn.dumbBorderFade = function() { return this.addClass( 'borderfade' ).animate({ 'borderWidth': '+10px' }, 1000).fadeOut(); }; // Now we can apply it to an element like so: jQuery('div#message').dumbBorderFade();
Comments
