关于jQuery.HISTORY的问题---上一个/下一个按钮&网页

时间:2010-10-25 21:59:35

标签: jquery image cycle

我对jQuery很新,并且在这里解决一些问题:)

我想创建一个像这样的画廊。

    [IMAGE]

[previous / next]

[1/5]< - (例如,如果我有5张图片,我想显示数字)

我通过使用jQuery Cycle Plugin来计算出prev / next按钮部分,但我无法弄清楚如何显示[1/5]部分。

有人可以借给我一个手吗? :)

1 个答案:

答案 0 :(得分:0)

嗯, I made this simple example 关于如何实现它,只使用没有插件的jQuery。

旋转是一条简单的线。如果您正在点击prev并且它已经在第一张图片中,请转到最后一张图片。如果你打到下一个,它已经在最后,请转到第一个。

if ($this.index() == 0) /* Previous */
{
    /* go 1 back or start at the end */
    current = ((current - 1) < 0 ? (total - 1) : (current - 1));
}
else /* Next */
{
    /* go 1 forward or start at the beginning */
    current = ((current + 1) == total ? 0 : (current + 1));
}

使用过的功能(参考)

相关问题