0

在 ResponsiveSlides 图像中显示计数器的任何方式

<script>
  $(function() {
    $(".rslides").responsiveSlides();
  });
</script>
4

2 回答 2

2

尝试这个

$(文档).ready(函数() {

    $("#slider").responsiveSlides({
        speed: 500,
        auto: false,
        before: function(){}, // Function: Before callback
        after: function(){
            $(".current").html($(".slider").find("li#" + $("." + this.namespace + "1_on").attr("id")).index() + 1);
        } // Function: After callback
    });

    // Total amount of images and apply to div
    $(".total").html($(".slider li").index() + 1);

});
于 2013-11-03T12:57:44.683 回答
2

//html/php

<ul id="rslides<?=$j?>" class="rslides slider" rel="<?=$j?>">
 image list here
</ul>

//js

$(".rslides").each(function() {
var id = $(this).attr('rel');

        $("#rslides"+id).responsiveSlides({
            auto: false,
            nav: true,
            speed: 500,
            maxwidth: 800,
            namespace: "unitSlides",
            after: function(){
                console.log(this);
                $("#slider_counter_"+id).html($(".slider").find("li#" + $("." + this.namespace + id +"_on").attr("id")).index() + 1);
            } 
        });
    });
于 2013-11-03T13:04:35.857 回答