滑动文本重叠

发布于 2024-09-18 11:52:35 字数 271 浏览 7 评论 0原文

我正在创建的 WordPress 滑块插件有一个小问题。我试图让文本在开头滑动,并在过渡到下一个图像之前滑动。这似乎工作正常,但是经过几次转换后,淡入淡出的滑块(顶部一个)文本开始重叠;下一张图片中的文本显示在幻灯片更改之前。

代码段:

http://pastebin.com/3WxgRWdg

感谢任何可以提供帮助的人。真的很感激。马修.

Having a slight issue with a slider plugin for Wordpress I am creating. I'm trying to get the text to slideUp at the beginning and slideDown just before the transition to the next image. This appears to work fine however after a few transition the slider that fades (top one) text starts to overlap; the text from the next image shows before the slide has changed.

And the code segment:

http://pastebin.com/3WxgRWdg

Thanks to anyone that can help. Really would appreciate it. Matthew.

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

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

发布评论

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

评论(1

掩饰不了的爱 2024-09-25 11:52:35

这是因为您的其他动画,请查看完整的功能:

var text = '.lof-main-item-desc';
$(text).slideUp(200);
this.wrapper.stop().delay(200).animate(obj, {
    duration: this.settings.duration,
    easing: this.settings.easing,
    complete: function() {
        $(text).slideDown(200);
    }
});

它正在做的是查找all .lof-main-item-desc 并影响它们,无论它们是否在另一张幻灯片中。您需要在双向滑动时仅查看此包装器,使其仅影响当前节目中的内容,如下所示:

var text = '.lof-main-item-desc';
$(this.wrapper).find(text).slideUp(200);
this.wrapper.stop().delay(200).animate(obj, {
    duration: this.settings.duration,
    easing: this.settings.easing,
    complete: function() {
        $(this).find(text).slideDown(200);
    }
});

It's because of your animation for the other one, check out the complete function:

var text = '.lof-main-item-desc';
$(text).slideUp(200);
this.wrapper.stop().delay(200).animate(obj, {
    duration: this.settings.duration,
    easing: this.settings.easing,
    complete: function() {
        $(text).slideDown(200);
    }
});

What this is doing is finding all .lof-main-item-desc and affecting them whether they're in another slideshow or not. You need to make it affect only the ones in the current show by only looking within this wrapper when sliding both directions, like this:

var text = '.lof-main-item-desc';
$(this.wrapper).find(text).slideUp(200);
this.wrapper.stop().delay(200).animate(obj, {
    duration: this.settings.duration,
    easing: this.settings.easing,
    complete: function() {
        $(this).find(text).slideDown(200);
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文