javascript 如何将 .owl-pagination 移到主要 owl 包装器之外?猫头鹰旋转木马2

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27817163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:02:04  来源:igfitidea点击:

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

javascriptowl-carousel

提问by Yunus Gaziev

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?

如果有一种简单的方法可以将 .owl-pagination 移动到主要 owl 包装器之外的另一个 div,那就太好了。想知道是否有一种直接的方法来实现这一目标?

回答by Yunus Gaziev

It works with standard options: navContainerand dotsContainer

它适用于标准选项:navContainerdotsContainer

html

html

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

javascript

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,

对于 OwlCarousel2 问题663

回答by Jeroen

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

您可以在 init 之后移动导航,就像在这个例子中一样: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)
    }
  });

});