当悬停Twitter Bootstrap轮播指示器然后激活相关的轮播项目?我是怎么做到的?
谢谢高级
答案 0 :(得分:1)
https://stackoverflow.com/a/10519603/3421811的代码可以帮助您
$('#myCarousel').bind('slid', function() {
// Get currently selected item
var item = $('#myCarousel .carousel-inner .item.active');
// Deactivate all nav links
$('#carousel-nav a').removeClass('active');
// Index is 1-based, use this to activate the nav link based on slide
var index = item.index() + 1;
$('#carousel-nav a:nth-child(' + index + ')').addClass('active');
});
答案 1 :(得分:0)
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
你可以把你的css diy