javascript - Jquery animate - callback executing before animation is complete -


what i'd accomplish element expand in height, , apply background image once height change complete. i've noticed background image in callback applies before height animation complete resulting in laggy performance. can tell me why is?

$(document).ready(function() {     $('#hero').animate({         height: ($(window).height() - $("#hero").offset().top - 50)      }, 100, function() {         $('#hero').css('background-image', 'url(./img/hero.jpg)');     }); }); 

you have transition: 1s ease on #hero, cause animation play erratically since trying use css3 animations animate jquery animation (and throw kinds of timing problems).

what suspect happening getting notified jquery animation completed, css3 animation doesn't complete additional 1s, why seeing are.


Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -