jQuery:用滑动代替淡入淡出

发布于 2024-07-24 10:45:28 字数 231 浏览 2 评论 0原文

我有下面的脚本来隐藏一个 div 的内容并显示另一个

$("#"+objCurrentDiv).fadeOut("slow",function(){
  $("#"+objNewDiv).fadeIn("slow");
});

div 这给了我淡入淡出效果。现在我想通过滑动(从左到右)替换淡入淡出效果。 我尝试了幻灯片显示方法,但无法成功。 任何人都可以帮我重写它吗?

I have the below script to hide the content of one div and show another

$("#"+objCurrentDiv).fadeOut("slow",function(){
  $("#"+objNewDiv).fadeIn("slow");
});

This is giving me the fading effect.Now i want to repalce the fade effect with sliding (left to right.
I tried the slide in show method, but could not succeed. Can any one help me to rewrite it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黎歌 2024-07-31 10:45:28

由于标准函数 .slideDown 和 .slideUp 将实现垂直效果,因此您必须像这样使用 .animate:

$("#"+objCurrentDiv).animate({'width':'0%','display':'none'},"slow",function(){
  $("#"+objNewDiv).animate({'width':'100%','display':'block'},"slow");
});

Since the standard function .slideDown and .slideUp will do the effect vertically, you have to use .animate like this:

$("#"+objCurrentDiv).animate({'width':'0%','display':'none'},"slow",function(){
  $("#"+objNewDiv).animate({'width':'100%','display':'block'},"slow");
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文