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

发布于 2024-09-01 12:29:23 字数 1917 浏览 5 评论 0原文

我试图弄清楚如何将多个寻呼机关联到多个 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 内部。

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

Im trying to figure out how I can have multiple pagers associated to multiple jquery cycle slideshows that are all on the same page without manually creating new classes and a script to reference them.

My HTML looks like this.

<!-- 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-->

My Jquery looks like.

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

I have multiple projects listed, each have their own slideshow, div.minislideshow. I would like the pager links to go inside the div.bulletnav for each project instance.

Any help would be greatly appreciated. If you need more info, let me know. Thanks.

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

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

发布评论

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

评论(2

浮世清欢 2024-09-08 12:29:23

我发现这确实很有帮助:

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)
    });    
});

I found this really helpful:

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

Basically they're doing a .each() for each slideshow and then passing the parentNode into the relevant links, like so:

$('section.portfolioItem .image').each(function(){
    var p = this.parentNode;
    $(this).cycle({
      timeout:  0,
      prev:   $('.prev', p),
      next:   $('.next', p),
      pager:  $('.slideshowNav', p)
    });    
});
不可一世的女人 2024-09-08 12:29:23

感谢您的代码。我发现了类似的代码,

 $('.minislideshow').each(function() {
    var $nav = $('<div class="pager"></div>').insertBefore(this);

    $(this).cycle({
        timeout: 2000,
        pager:   $nav
    });
 }); 

它似乎在做同样的事情。我现在的问题是幻灯片中除第一张之外的图像不显示。显示的寻呼机图标代表每个 div 容器中幻灯片的数量,但我不知道如何显示图像。他们在第一天似乎工作得很好。如果我为幻灯片放映设置多个 div 并为每个 div 指定一个唯一的类,然后为每个类创建 JavaScript,我就可以获得我正在寻找的结果。上面的代码有所帮助,因此我不必为每个实例手动创建一个新类,但第一个容器旁边的其他容器中的幻灯片图像现在似乎没有显示?

Thanks for the code. I found a similar code,

 $('.minislideshow').each(function() {
    var $nav = $('<div class="pager"></div>').insertBefore(this);

    $(this).cycle({
        timeout: 2000,
        pager:   $nav
    });
 }); 

It seems to be doing the same thing. My problem now is that images in the slides other than the first one do not show up. Pager icons show up representing the number of slides in each div container, yet I cant figure out how to get the images to show up. They seem to work fine on the 1st one. I can get the result I'm looking for, if I set up multiple div for the slide show and give each one a unique class and then create JavaScript for each class. The code above helped so I don't have to manually create a new class for each instance, yet the slide images in the other containers beside the first one don't seem to be showing up now?

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