【问题标题】:hide next button in bootstrap modal carousel在引导模式轮播中隐藏下一个按钮
【发布时间】:2014-02-12 14:10:18
【问题描述】:

我用这个

https://github.com/blueimp/Bootstrap-Image-Gallery

用于引导模式中的引导轮播。这完美地工作。但是我需要隐藏上一个按钮,如果我在第一张幻灯片上并隐藏下一个按钮,如果我在最后一张幻灯片上有没有办法处理这个问题?

【问题讨论】:

    标签: twitter-bootstrap carousel blueimp


    【解决方案1】:

    首先,禁用连续

    var options = {
    //Allow continuous navigation, moving from last to first
    // and from first to last slide:
    
    continuous: false,
    };
    
    or make
    
    continuous: !1  // In jquery.blueimp-gallery.min.js
    

    其次,在下一个和上一个按钮上添加id

    <button id="prv" type="button" class="btn btn-default pull-left prev">
         Previous
    </button>
    <button id="nxt" type="button" class="btn btn-primary next">
         Next
    </button>
    

    三、为id的添加CSS

    .blueimp-gallery-left #prv, .blueimp-gallery-right #nxt{
    display: none; }
    

    【讨论】:

      【解决方案2】:

      您可以使用文档中的事件回调函数。您可以在几个功能的基础上隐藏上一个和下一个按钮(documentation

      var gallery = blueimp.Gallery(
          linkList,
          {
              onopened: function () {
                  // Callback function executed when the Gallery has been initialized
                  // and the initialization transition has been completed.
              },
              onslidecomplete: function (index, slide) {
                  // Callback function executed on slide content load.
              },
      
          }
      );
      

      或者尝试在var选项上设置carousel: false

      【讨论】:

      • 谢谢。我的JS知识薄弱,我知道该怎么做。
      • 先尝试第二种方法,因为它更容易。您只需将其包含在 JS 的 var option 中即可。运行脚本时,它必须位于代码中的某个位置。
      • 我尝试给carousel:false,但第一张/最后一张幻灯片仍然可见上一个/下一个按钮
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 1970-01-01
      • 2013-12-26
      • 1970-01-01
      • 2022-12-06
      • 1970-01-01
      相关资源
      最近更新 更多