lundi 2 février 2015

Animation (bound to scrollTop) only finshes when I stop scrolling


My animation event nearly pauses or lets say gets significantly slower at completing when scroll reaches more than 15 percent. Why is that? If should animate to the left but instead it does so only when I stop scrolling.



$(window).scroll(function ()
{
var content_height = $(document).height();
var content_scroll_pos = $(window).scrollTop();
var percentage_value = content_scroll_pos * 100 / content_height;

if(percentage_value > 15)
{
TweenMax.to(".bar", 3, {right:"0", ease:Bounce.easeOut})

}
else
{
TweenMax.to(".bar", 2, {right:"-125%", ease:Power2.easeOut})

}
});




Aucun commentaire:

Enregistrer un commentaire