문제

Any way to show counter in ResponsiveSlides image

<script>
  $(function() {
    $(".rslides").responsiveSlides();
  });
</script>
도움이 되었습니까?

해결책

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

다른 팁

Try this

$(document).ready(function() {

    $("#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);

});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top