jQuery 循环插件:让分页器在混合内容幻灯片 div 中进行转换

发布于 2024-10-21 06:02:30 字数 3911 浏览 2 评论 0原文

我一直在尝试 Malsup 很棒的 jQuery 循环插件,但遇到了一些障碍。我一直在我的过渡 div 中使用混合内容,效果很好。当我在转换 div 中使用寻呼机时会出现问题。本质上,我希望寻呼机链接与每个 div 一起转换,因此我将寻呼机 div 包含在每个转换 div 中。

$(document).ready(function() { $('#slider').cycle ({ fx: 'scrollLeft', timeout: 10000, speed: 500, pager: '#pager' }); }); IMAGE TEXT TEXT TEXT Try It Now!Terms & Conditions Apply a
        <!-- Content Display 1 -->
        <div id="cs_1" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top: 20px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;">b</div>
        </div>
        <!-- Content Display 1 -->

        <!-- Content Display 2 -->
        <div id="cs_2" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top 26px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
        </div>
        <!-- Content Display 2 -->

        <!-- Content Display 3 -->
        <div id="cs_3" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top 18px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
        </div>
        <!-- Content Display 3 -->

寻呼机在第一张幻灯片上显示良好,并且完全按照我想要的方式进行转换,尽管我在前两个寻呼机 div 中放入的测试字母出现了,但它不会出现在以下三个转换中。我在这里缺少什么?

I have been experiment with Malsup's awesome jQuery cycle plugin and have hit a bit of a snag. I have been using mixed content in my transition div which has worked out fine. The problem occurs when I use pager within the transition divs. Essentially I would like the pager links to transition along with each div so I included the pager div within each transition div.

$(document).ready(function() {
$('#slider').cycle ({
fx: 'scrollLeft',
timeout: 10000,
speed: 500,
pager: '#pager'
});
});

IMAGE
TEXT
TEXT
TEXT

Try It Now!Terms & Conditions Apply

a

        <!-- Content Display 1 -->
        <div id="cs_1" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top: 20px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;">b</div>
        </div>
        <!-- Content Display 1 -->

        <!-- Content Display 2 -->
        <div id="cs_2" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top 26px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
        </div>
        <!-- Content Display 2 -->

        <!-- Content Display 3 -->
        <div id="cs_3" class="show_content clearb">
            <div class="">IMAGE</div>
            <div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
            <div class="button gradient3" style="height: 57px; width: 180px; margin-top 18px;">
                <a href ="signup.php"><div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div></a>
            </div>
            <div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
        </div>
        <!-- Content Display 3 -->

The pager shows up fine on the first slide and transitions out exactly the way I want it to, it does not appear on the following three transitions although the test letters i put in the first two pager divs do. What is it that I am missing here?

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

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

发布评论

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

评论(1

云柯 2024-10-28 06:02:30

经过更多的实验后,修复出奇地简单,但也得到了一个奇怪的结果。我所做的就是为寻呼机调用提供第二个参数:

$(document).ready(function() {
$('#slider').cycle ({
fx: 'scrollLeft',
timeout: 10000,
speed: 500,
pager: '#pager, #pager2'
});
});

我将第二张幻灯片上的寻呼机重命名为 pager2,瞧!然而奇怪的事情发生了,滑块出现在我没有重命名的两个后续面板上!当寻呼机中只有一个参数时,尽管所有参数都被命名为#pager,但它们并没有出现。添加第二个参数 #pager2 后,所有以前未出现过的名为 #pager 的控件现在似乎都出现了。删除第二个参数会将其恢复到仅出现第一组控件的状态。奇怪,但工作正常,所以我没有抱怨。

Well after a bit more experimentation the fix was surprisingly simple but also had an odd result. All I did was supply a second parm to the pager call:

$(document).ready(function() {
$('#slider').cycle ({
fx: 'scrollLeft',
timeout: 10000,
speed: 500,
pager: '#pager, #pager2'
});
});

I renamed the pager on my second slide to pager2 and voila! However something odd happened, the slider appeared on the two subsequent panels that I had NOT renamed! When there was only one parm in pager they did not appear despite all having been named #pager. Once I added the second parm #pager2, all of the controls named #pager that had not appeared before now seem to be appearing. Removing the second parm reverts it back to the state where only the first set of controls appeared. Odd, but working so I'm not complaining.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文