/ Published in: JavaScript

Plugin Source.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function($){ //Define the plugin, named 'linkNudge' $.fn.linkNudge = function(params){ //set default parameters params = $.extend({ padding: 20, elapseTime: 300, returnPadding: 0}, params); //Traverse every node passed this.each(function(){ //Define this as a single object var $t = $(this); //Proceed to nudge on hover $t.hover(function(){ $t.stop().css('cursor', 'pointer').animate({paddingLeft: params.padding}, params.elapseTime); }, function(){ $t.stop().animate({paddingLeft: params.returnPadding}, params.elapseTime); }); }); return this;//Allow for chaining. }; })(jQuery);
URL: http://dev-tips.com/featured/link-nudge-jquery-plugin
Comments
