Carousel pills/progress
It would be nice to have some indication of the total number of items in the carousel and the current position of the carousel.
Many other carousel widgets use pills to display this information.
+1
+1
(and responsive prev/next buttons would be great too)
+1
+1
+1
+1 Can't remember the last modern slideshow I saw that didn't have the dots for navigation. Ex: http://www.apple.com/macosx/mountain-lion/
+1 The demo of www.swipejs.com has this feature too.
+1
+1
+1
+1
+!
+1
You can do something like this (tnx to nicolas chenet):
var mainSlider = $('#main-slider').carousel().bind('slid', function() {
var index = $(this).find(".active").index();
$("#slider-indicator a").removeClass('active').eq(index).addClass('active');
});
$("#slider-indicator a").click(function(e){
var index = $(this).index();
mainSlider.carousel(index);
e.preventDefault();
});
And add some code like this (outside the carousel):
<div id="slider-indicator">
<a class="active">1</a>
<a>2</a>
<a>3</a>
</div>
But a standard implementation would be nice though.
Tagging this issue as popular, please stop commenting on this issue with +1. thanks!
Here's how I got this working. Works exactly like you would expect:
- carousel rotates automatically
- bullets increment automatically as carousel rotates
- bullets are clickable
HTML
<div class="carousel-nav">
<a href="#" data-to="0" class="active">1</a>
<a href="#" data-to="1">2</a>
<a href="#" data-to="2">3</a>
<a href="#" data-to="3">4</a>
</div>
JS
$('#carousel-screenshots').carousel({
interval: 5000
});
$(".carousel-nav a").click(function(e){
e.preventDefault();
var index = parseInt($(this).attr('data-to'));
$('#carousel-screenshots').carousel(index);
var nav = $('.carousel-nav');
var item = nav.find('a').get(index);
nav.find('a.active').removeClass('active');
$(item).addClass('active');
});
$("#carousel-screenshots").bind('slide', function(e) {
var elements = 4;
var nav = $('.carousel-nav');
var index = $('#carousel-screenshots').find('.item.active').index();
index = (index == elements - 1) ? 0 : index + 1;
var item = nav.find('a').get(index);
nav.find('a.active').removeClass('active');
$(item).addClass('active');
});
CSS The following css should get you started; bullets.png is a sprite with active and inactive states
.carousel-nav a {
width: 12px;
height: 12px;
background: url('../img/bullets.png') no-repeat;
text-indent: -9999px;
border: 0;
float: left;
margin-left: 5px;
}
.carousel-nav a.active {
background-position:0 -12px;
}
Это пиздец... Идите и принесите алкоголь.
+1
+1
+1