jquery - 同一页面上多个 Jquery 循环实例的多个分页器?

标签 jquery pager jquery-cycle

我试图弄清楚如何将多个寻呼机关联到多个 jquery 循环幻灯片,这些幻灯片都位于同一页面上,而无需手动创建新类和引用它们的脚本。

我的 HTML 看起来像这样。

<!-- PROJECT -->
        <div title="Challenge Factor" class="project">

          <div class="projectinfo-top">
                <div class="project-title"><h2>Challenge Factor</h2></div>
                <div class="bulletnav"></div>
          </div>

            <div class="minislideshow-bg">
                <div class="minislideshow">
                  <img src="project-slides/challengefactor-1.jpg" width="729" height="425" alt="Challenge Factor" />
                  <img src="project-slides/challengefactor-2.jpg" width="729" height="425" alt="Challenge Factor" />
                  <img src="project-slides/challengefactor-3.jpg" width="729" height="425" alt="Challenge Factor" />
                  <img src="project-slides/challengefactor-4.jpg" width="729" height="425" alt="Challenge Factor" />
                </div>
            </div>

            <div class="projectinfo-text">

                <p>ChallengeFactor.com is a new social network based on user created challenges that push members to better themselves and the lives around them. Webphibian was contacted to develop the social network from scratch and tie it into Challenge Factor's current branding. My role on this project was to design the social network side of the site, redesign their current site, and all front-end development.</p>
            </div><!--/project info text-->

        </div><!--/PROJECT-->

我的 Jquery 看起来像。

$(function() { $('.minislideshow').cycle({ timeout: 0, pager:'.bulletnav' }); }); 

我列出了多个项目,每个项目都有自己的幻灯片,div.minislideshow。我希望寻呼机链接进入每个项目实例的 div.bulletnav 内部。

任何帮助将不胜感激。如果您需要更多信息,请告诉我。谢谢。

最佳答案

我发现这真的很有帮助:

http://forum.jquery.com/topic/jquery-cycle-plugin-set-up-multiple-containers-with-same-options

基本上,他们为每个幻灯片执行 .each() ,然后将parentNode传递到相关链接,如下所示:

$('section.portfolioItem .image').each(function(){
    var p = this.parentNode;
    $(this).cycle({
      timeout:  0,
      prev:   $('.prev', p),
      next:   $('.next', p),
      pager:  $('.slideshowNav', p)
    });    
});

关于jquery - 同一页面上多个 Jquery 循环实例的多个分页器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2851903/

相关文章:

javascript - 如何从javascript获取Bootstrap 3动态下拉模式对话框中的选定项目

javascript - jQuery UI 如何创建其精确复制的绝对定位拖动助手?

javascript - 灯箱弹出窗口中的多步表单

drupal - 我的 Drupal View 寻呼机在哪里?

javascript - Jquery 循环和 Ajax 字幕

jQuery 循环 : Disable Initial 'After' Callback

javascript - 无法关闭 Accordion

android - 查看带有单个背景图片的寻呼机android

jQuery 幻灯片 : how do I modify this code to show a custom pager per slide?