jquery .show('slow') direction?

删除回忆录丶 提交于 2019-12-09 14:04:02

问题


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')


回答1:


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..




回答2:


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().




回答3:


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.




回答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.



来源:https://stackoverflow.com/questions/7099191/jquery-showslow-direction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!