如何在 jquery-ui 中使用幻灯片效果?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4703299/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:45:38  来源:igfitidea点击:

How to use Slide effect with jquery-ui?

jqueryjquery-ui

提问by Chirag

Hey guys I have following code so far but not sure how I can use jquery slide effect on an image I'm loading in a

嘿伙计们,到目前为止,我有以下代码,但不确定如何在我正在加载的图像上使用 jquery 幻灯片效果

.js I have loaded so far

.js 到目前为止我已经加载

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jqueryui.js"></script>

The HTML code is

HTML代码是

<div align="center"><img src="images/personal_photo.png" width="900" height="850" alt="Awesome effects"></div>

Note: Since I dont know how to apply the jquery-ui effects I have not done anything with the code.

注意:由于我不知道如何应用 jquery-ui 效果,所以我没有对代码做任何事情。

回答by sunn0

$("img").click(function () {
      $(this).hide("slide", { direction: "left" }, 1000); 
});

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

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

回答by Mike

If you want to show the object and you want the slide to be towards the leftthen you have to reverse the direction of the slide. So something like:

如果要显示对象并且希望幻灯片向左,则必须反转幻灯片的方向。所以像:

$("img").click(function () {
  $(this).show("slide", { direction: "right" }, 1000); 

});

});