7

Is it possible to have easing with this:

('#sideBar').hide('slide', {direction: 'right' }, 
    800, function(){...});

At the moment it is very jittery as it is moving maybe.. 100 - 500 pixels (depending on content). I have been looking google and most people say to use easing, but when looking at the documentation i cannot see a property for easing.

billyonecan
  • 20,090
  • 8
  • 42
  • 64
Josh Boothe
  • 1,413
  • 4
  • 25
  • 40
  • Nope - only jquery library and `jquery.effects.slide.js`, `jquery.effects.core.js` everything else is my own – Josh Boothe May 10 '13 at 10:21
  • 1
    It would be more helpful to provide a link to the two plugins you mentioned, and recreate your problem on http://jsfiddle.net – Samuel Liew May 10 '13 at 10:24

3 Answers3

7

You can specify the easing property in the options object (the second argument):

$('#sideBar').hide('slide', { direction: 'right', easing: 'easeOutBounce' }, 
    800, function(){...});

Check out the easing documentation

Here's an example

Community
  • 1
  • 1
billyonecan
  • 20,090
  • 8
  • 42
  • 64
  • Thanks for this! Perfect :) I tried this before with linear, which didnt seem to fix it, I have just tried swing after your suggestion and it is next to perfect so thank you! – Josh Boothe May 10 '13 at 10:34
  • 1
    Example has expired :( – Dropout Jul 24 '15 at 11:40
  • I wonder why its not working for me. The only syntax that is working is `element.hide(200, 'swing', function(){});`. If I try anything else, its not animating anything anymore. Any idea why? – C4d Mar 16 '17 at 18:33
0

First correct with

 jQUery('#sideBar').hide('slide', {direction: 'right' }, 
 800, function(){...});

http://docs.jquery.com/UI/Effects/Slide

Look on below page

http://docs.jquery.com/UI/Effects/Slide

OR

you can use animate

http://api.jquery.com/animate/

Also you can find easing cheat

For example.

http://gsgd.co.uk/sandbox/jquery/easing/

http://jqueryui.com/resources/demos/effect/easing.html

http://easings.net/

Kishan Patel
  • 1,358
  • 10
  • 24
0

You can download the JQuery easing plugin from http://gsgd.co.uk/sandbox/jquery/easing, which provides smoother animations than the default ones included with jQuery. You can then easily set your global easing animation using the following code:

jQuery.easing.def = "easeInOutExpo";

You can of course choose whichever easing animation you prefer. This will affect all of your jQuery animations on the page, which isn't a bad thing if you're looking for consistency.

Maloric
  • 5,525
  • 3
  • 31
  • 46