jquery .show('slow') direction?
Asked Answered
T

4

26

Is it possible to change direction of $("selector").show('slow') and hide('slow') effects in jQuery?

I can define directions for other effects such as slide and clip, but there's no option for show or hide('slow')

Tyus answered 17/8, 2011 at 20:40 Comment(0)
C
7

show() is just an arbitrary function to display an element on a page. Without the argument it wouldn't even have an animation. If you want access to more elaborate animations and control the direction it fades in on you will need to use .animate()

Or use an extra library that extends jQuery's native functions like jQuery UI

show() on itself doesn't have any extra effects though..

Chrysanthemum answered 17/8, 2011 at 20:46 Comment(1)
.show can be defaulted to a direction (out of the box it is from the right to left)Latoya
H
23

I can't respond directly to the comments on Norman Joyner's post (not enough rep), but I think you are confused about what 'slow' is. Slow is not an effect like 'slide.' 'Slow' is the speed of the effect. So you should be able to specify

$(this).hide("slide", {direction: "right" }, "slow");

You can't put a direction directly on "slow."

EDIT: Oh, I think I know what you are asking. The default effect on "hide" appears to be "blind." According to this - http://docs.jquery.com/UI/Effects/Blind - the only directions you can specify on blind are horizontal and vertical. Horizontal goes from right to left and vertical from bottom to top. If you want the reverse of those, you'll have to use animate().

Hoick answered 5/10, 2012 at 15:25 Comment(2)
It requires jQuery UIGodchild
.show can be defaulted to a direction (out of the box it is from the right to left)Latoya
K
19

There are also sliding jquery effects if you simply want vertical direction:

.slideDown() .slideUp() and .slideToggle()

Their parameters and usage are almost the same of the .show() effect.

Kalmar answered 5/8, 2014 at 12:13 Comment(2)
the best answer since it objectively replies to OP problem, without further installing jQuery UIGuaco
.show can be defaulted to a direction (out of the box it is from the right to left)Latoya
C
7

show() is just an arbitrary function to display an element on a page. Without the argument it wouldn't even have an animation. If you want access to more elaborate animations and control the direction it fades in on you will need to use .animate()

Or use an extra library that extends jQuery's native functions like jQuery UI

show() on itself doesn't have any extra effects though..

Chrysanthemum answered 17/8, 2011 at 20:46 Comment(1)
.show can be defaulted to a direction (out of the box it is from the right to left)Latoya
W
4

You can perform special effects with the .show() and hide() functions using jQuery UI.

Other than that you can use the default .slideUp() and .slideDown() or specify a direction for slide in jQuery UI by doing something like:

$(this).hide("slide", { direction: "right" }, 1000);

I hope this helps.

Weingarten answered 17/8, 2011 at 20:45 Comment(2)
// As I state above, i already know that I can define directions for slide and clip. I need the effect that comes with 'slow'.Tyus
Using 'slow' with the slide effect in any direction? I am confused as to what you are asking.Weingarten

© 2022 - 2024 — McMap. All rights reserved.