0

How to rewrite this code, so it would fly in with easing not just fade in.

Code -

jQuery('#swiftslider-slide-'+newSlide).addClass('active').fadeIn('300');

Could you give me a full example? I understand I must use .animate() but if I do like this -

jQuery('#swiftslider-slide-'+newSlide).addClass('active').animate({opacity: "show"}, { duration: "slow", easing: "easein" });;

it doesn't work.

Hope you will be able to help me.

y2ok
  • 660
  • 5
  • 18
  • 1
    It's not working because, by default, there's no such thing as `easein` in jQuery. Without using your own function or plugin, [the only two default jQuery animation easing options are `swing` and `linear`](http://api.jquery.com/animate/). See [this question](http://stackoverflow.com/questions/5207301/looking-for-jquery-easing-functions-without-using-a-plugin) to learn more about easing functions. – Sparky Jun 09 '12 at 14:56
  • okay, but how does the other sliders (premium sliders), get sliding effects, like slide from left to right, from top to bottom e.c? – y2ok Jun 09 '12 at 15:10
  • They `animate()` the `position` of the element. See [jquery docs](http://api.jquery.com/animate/) for more info. – Sparky Jun 09 '12 at 15:13

1 Answers1

0

Thanks, Sparky672.

It's not working because, by default, there's no such thing as easein in jQuery. Without using your own function or plugin, the only two default jQuery animation easing options are swing and linear. See this question to learn more about easing functions.

y2ok
  • 660
  • 5
  • 18