iosscripts / iosslider

iosslider is a jQuery plugin which allows you to integrate a customizable, cross-browser content slider into your web presence. Designed for use as a content slider, website banner, or image gallery.
http://iosscripts.com/iosslider
432 stars 103 forks source link

Create dinamic bullets #309

Closed elchiconube closed 10 years ago

elchiconube commented 10 years ago

Hi, i need some help, i want to print a dynamic number of bullets depending of the number of slides. Can be possible? Thanks

marcwhitbread commented 10 years ago

@elchiconube take a look at the solution I provided in issue #304. In the onSliderLoaded callback you can use the numberOfSlides variable to create a specific number of dynamic bullets within a defined container. You could approach it like so:

onSliderLoaded: function(args) {

    var number_of_slides = args.data.numberOfSlides;

    for(var i = 0; i < number_of_slides; i++) {
        $('.bullet-container').append("<div class = 'bullet' onclick = \"$('.iosSlider').iosSlider('goToSlide', " + i + ");\"></div>");
    }

}

The CSS for the bullets and container would be up to you.