jQuery Cycle插件:同一页面上不同画廊的多个传呼器 [英] jQuery Cycle Plugin: Multiple Pagers for different galleries on same page

查看:97
本文介绍了jQuery Cycle插件:同一页面上不同画廊的多个传呼器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只有一个页面,其中包含缩略图周期"画廊的多个实例.问题是,分页系统变得一团糟(将所有内容全部添加进来).对你们来说,这可能很简单,但这就是我所拥有的:

I've got a single page which has multiple instances of a thumbnail 'cycle' gallery. Problem is though, the Paging system gets all messed up (it's adding all in one or something). It's probably something very simple for you guys, but this is what I've got:

$(function(){ 
$('div.gallery')
.before('<div class="imgSelect">')
.each(function() {
$('.imgWrap ul').cycle({
fx: 'fade',
speed: 'fast',
timeout: 0,
pager:  '.imgSelect'
    });
  });
});

HTML:

<div class="imgWrap">
    <div class="gallery">
        <ul>
            <li><img src="images/travel1.jpg" alt="" /></li>
            <li><img src="images/travel2.jpg" alt="" /></li>
            <li><img src="images/travel3.jpg" alt="" /></li>
        </ul>
    </div>
   </div>

我基本上是想说,对于每个称为".gallery"的div,在其前面添加一个Pager div(.imgSelect)-但所有这些寻呼机都应仅计算该图库中的图像.

I'm basically trying to say, for each div called '.gallery', add a Pager div (.imgSelect) before it - but all these pagers should count only the images within that gallery.

任何帮助将不胜感激, 干杯.

Any help would be much appreciated, Cheers.

推荐答案

这应该有效:

$(function() {
    $('.gallery ul').each(function(i) {
        $(this).before('<div class="imgSelect imgSelect'+i+'">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 2000,
            pager:  '.imgSelect' + i
            });
        });
    });

注意:超时以毫秒为单位,将其设置为零将停止循环:D

note: the timeout is in millisecond, setting it to zero will stop the cycle :D

hth.

这篇关于jQuery Cycle插件:同一页面上不同画廊的多个传呼器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆