javascript - 如何在 Twitter Bootstrap 轮播页面加载后隐藏左键?

标签 javascript jquery twitter-bootstrap

如何在 Twitter Bootstrap 轮播页面加载后隐藏左键?

http://twitter.github.com/bootstrap/javascript.html#carousel

我的尝试(它在第一次操作后有效,我需要所有时间):

$('#myCarousel').on('slid', '', function() {
    var $this = $(this);

    $this.children('.carousel-control').show();
    if($('.carousel-inner .item:first').hasClass('active')) {
      $this.children('.left.carousel-control').hide();
    } 
    else if($('.carousel-inner .item:last').hasClass('active')) {
      $this.children('.right.carousel-control').hide();
  }

});

最佳答案

在页面加载后简单地隐藏左按钮。因为它总是从第一张幻灯片开始。

$('#myCarousel > .left.carousel-control').hide();

或者,在页面加载后手动触发一个slid事件。

$('#myCarousel').on('slid', '', function () {
  ...
}).trigger('slid');

关于javascript - 如何在 Twitter Bootstrap 轮播页面加载后隐藏左键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14925043/

相关文章:

javascript - 从定义的元素总数中获取第一个特定元素

javascript - 如何根据日期和时间创建时间戳

ruby-on-rails - 尝试获取 link_to 以便在 ruby​​ on Rails 中使用缩略图

javascript - 我能否让 Internet Explorer 调试器中断长时间运行的 JavaScript 代码?

javascript - Silverlight 和 JavaScript 通信

javascript - HighCharts + reveal.js 图表大小

jquery - 在下拉列表中显示 Excel 表格

javascript - jQuery 中的汉堡菜单

javascript - 克隆时 Bootstrap 工具提示不会消失

javascript - Bootstrap表导出数据问题