How can I move .owl-pagination outside the primary

2019-08-04 07:28发布

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?

2条回答
倾城 Initia
2楼-- · 2019-08-04 08:04

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, Full screen result in JsFiddle

查看更多
Ridiculous、
3楼-- · 2019-08-04 08:10

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)
    }
  });

});
查看更多
登录 后发表回答