Twitter Bootstrap轮播指标悬停效果

时间:2014-12-22 07:33:37

标签: javascript jquery twitter-bootstrap

当悬停Twitter Bootstrap轮播指示器然后激活相关的轮播项目?我是怎么做到的?

谢谢高级

2 个答案:

答案 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