【问题标题】:Can I show numbers in jQuery Cycle我可以在 jQuery Cycle 中显示数字吗
【发布时间】:2012-12-28 21:11:02
【问题描述】:

我主要使用jQuery Cycle来做banner rotator,但在目前的工作中,需要在jQuery cycle中显示数字。那么有可能这样做吗?如果是,那怎么办?我在 jQuery Cycle 的文档中没有看到任何这样的东西,也没有在它的任何演示中看到这样的编号。

我宁愿使用这个带有数字的插件,而不是探索和使用其他插件。

【问题讨论】:

  • @Syon 是的,你是对的,我错过了它,这就是我想要的,如果你把它放在答案中,那么我将能够将它标记为正确答案。
  • 太棒了 - 抱歉回复晚了。

标签: jquery jquery-cycle web-frontend


【解决方案1】:

你当然可以。 jQuery Cycle 是一个精心设计的插件,它具有可用作幻灯片转换前后的回调函数。只需使用before 回调来获取当前幻灯片的编号并对其进行处理。

现场示例:http://jsfiddle.net/5ZqFA/

var $slideshowImages = $('.slideshow img'),
    $number = $('#number');

$('.slideshow').cycle({
    fx: 'fade',
    startingSlide: 0,
    before: function (currSlideElement, nextSlideElement, options, forwardFlag) {

        var $img = $(nextSlideElement),
            number = $slideshowImages.index($img);

        number += 1;

        $number.text(number);
    }
});​

插件的选项记录在这里:http://jquery.malsup.com/cycle/options.html

【讨论】:

  • 感谢 Nate,但我说的是这样的编号:1.s3.envato.com/files/6091024/index.html 不仅仅是编号,是的,我认为 Syon 在评论中指出了我们完全正确的想法,我正在寻找我错过的东西。
  • 明白了。很高兴你得到了答案!
【解决方案2】:

以下是 Cycle Plugin 中用于使用寻呼机的文档: Cycle Pager - http://jquery.malsup.com/cycle/pager.html

【讨论】:

    猜你喜欢
    • 2011-12-28
    • 1970-01-01
    • 2022-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-09
    • 1970-01-01
    相关资源
    最近更新 更多