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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -