Authoring a plugin function with jQuery -
hey dudes, have following function:
$.fn.slideout = function(speed,dir) { this.animate({ dir: '-1000px' }, speed); }; but direction (dir) isn't being carried on , isn't giving me error either.
i'm calling so: $('#element').slideout(500,'top');
so quesiton = why not animating? :(
if want use variable property name, cannot use object literals. first have create object , set property "array access" syntax:
$.fn.slideout = function(speed,dir) { var options = {}; options[dir] = '-1000px'; this.animate(options, speed); };
Comments
Post a Comment