Frage

I am using the ScrollTo plugin by Ariel Flesler.

I can't get the onAfter function to work, if I do this the page scrolls but the alert isn't called.

$.scrollTo('#'+id+'_anchor', 500, 'easeInCubic', { 
   onAfter:function(){
      alert('test');
   }
});
War es hilfreich?

Lösung

Try this:

$.scrollTo('#'+id+'_anchor', 500, {
   easing : 'easeInCubic',
   onAfter : function(){
      alert('test');
   }
});

According to the doco you have two ways to call it:

$(...).scrollTo( target, duration, settings );
$(...).scrollTo( target, settings );

...but not with the easing as a separate parameter like you had:

$(...).scrollTo( target, duration, easing, settings );

You need to make the easing one of the properties of the settings object.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top