javascript - jQuery callback not firing when declaring complete:? -


i have animation remove content screen scaling opacity down 0. want set css property of visibility hidden. in order sequence correct, have been trying use alert box know when event triggers. alert box not show. here code:

                $('.save-hidden').animate({                     opacity: 0,                      complete: function() { alert('executes now.');}                 }, 2000); 

is syntax correct calling function? said, alert never displays.

i intend replace following call:

                $('.save-hidden').css({ visibility: "visible"}); 

thanks!

jquery's animate() supports 2 different types of syntax, first 1 being

.animate( properties [, duration ] [, easing ] [, complete ] ) 

which use way

$('.save-hidden').animate({opacity: 0}, 2000, function() {      alert('executes now.');} }); 

the second syntax, looks 1 you're trying use, be

.animate( properties, options ) 

here use 2 objects, first 1 containing properties animate, , second 1 containing options, complete() etc.

in other words, complete callback not belong in object properties animate, 1 can add object second argument, containing properties duration, complete, queue etc.
note syntax have callbacks, easings etc. in options object, , accept 2 arguments.

$('.save-hidden').animate({     opacity: 0 }, {     complete: function() {          alert('executes now.');     },     duration : 2000 }); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -