jquery .show('slow') 方向?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7099191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery .show('slow') direction?
提问by Moon
Is it possible to change direction of $("selector").show('slow')
and hide('slow')
effects in jQuery?
是否可以更改jQuery 中的方向$("selector").show('slow')
和hide('slow')
效果?
I can define directions for other effects such as slide and clip, but there's no option for show or hide('slow')
我可以定义其他效果的方向,例如幻灯片和剪辑,但没有显示或显示的选项 hide('slow')
采纳答案by sg3s
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()
show()
只是在页面上显示元素的任意函数。如果没有参数,它甚至不会有动画。如果您想访问更精细的动画并控制它淡入的方向,您将需要使用.animate()
Or use an extra library that extends jQuery's native functions like jQuery UI
或者使用一个额外的库来扩展 jQuery 的原生功能,比如jQuery UI
show()
on itself doesn't have any extra effects though..
show()
虽然本身没有任何额外的影响..
回答by tandrewnichols
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
我无法直接回复对 Norman Joyner 帖子的评论(没有足够的代表),但我认为您对“慢”是什么感到困惑。慢不像“幻灯片”那样的效果。“慢”是效果的速度。所以你应该能够指定
$(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().
编辑:哦,我想我知道你在问什么。“隐藏”的默认效果似乎是“盲目”。根据这个 - http://docs.jquery.com/UI/Effects/Blind- 您可以在盲人上指定的唯一方向是水平和垂直。水平从右到左,垂直从下到上。如果你想要相反的,你将不得不使用 animate()。
回答by T30
回答by Norman Joyner
You can perform special effects with the .show()
and hide()
functions using jQuery UI.
您可以使用jQuery UI.show()
和hide()
函数执行特殊效果。
Other than that you can use the default .slideUp()
and .slideDown()
or specify a direction for slide in jQuery UI by doing something like:
除此之外,您可以通过执行以下操作使用默认值.slideUp()
和/.slideDown()
或指定 jQuery UI 中的滑动方向:
$(this).hide("slide", { direction: "right" }, 1000);
I hope this helps.
我希望这有帮助。