How can I move .owl-pagination outside the primary owl wrapper? OwlCarousel2

↘锁芯ラ 提交于 2019-12-11 08:27:53

问题


It would be great if there was a simple way to move .owl-pagination to another div outside the primary owl wrapper. Wondering if there is a straightforward way to accomplish this?


回答1:


It works with standard options: navContainer and dotsContainer

html

<!-- html custom containers -->
<div id="customNav" class="owl-nav"></div>
<div id="customDots" class="owl-dots"></div>

javascript

$('#owl-carousel').owlCarousel({
    // move navContainer outside the primary owl wrapper
    navContainer: '#customNav',
    // move dotsContainer outside the primary owl wrapper
    dotsContainer: '#customDots',

   // other OwlCarousel2 options
})

For OwlCarousel2 issue 663,




回答2:


You can move the navigation after init, like in this example: http://owlgraphic.com/owlcarousel/demos/navOnTop2.html

$(document).ready(function() {

  $("#owl-demo").owlCarousel({
    navigation:true,
    afterInit : function(elem){
      var that = this
      that.owlControls.prependTo(elem)
    }
  });

});


来源:https://stackoverflow.com/questions/27817163/how-can-i-move-owl-pagination-outside-the-primary-owl-wrapper-owlcarousel2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!