以下是 Owl Carousel own site的代码。我不知道为什么没有调用回调函数(这里是 afterMove )!任何人都可以调用 afterMove 函数吗?对我而言,它不仅仅是 afterMove ,但没有一个回调可行!
<html>
<head>
<!-- Owl Carousel -->
<link rel="stylesheet" href="js/vendors/owl-carousel-2/assets/owl.carousel.min.css">
<!-- Owl Default Theme -->
<link rel="stylesheet" href="js/vendors/owl-carousel-2/assets/owl.theme.default.min.css">
<style type="text/css">
#owl-demo .item {
background: #3fbf79;
padding: 30px 0px;
margin: 10px;
color: #FFF;
border-radius: 3px;
text-align: center;
}
</style>
</head>
<body>
<div id="owl-demo" class="owl-carousel">
<div class="item"><h1>0</h1></div>
<div class="item"><h1>1</h1></div>
<div class="item"><h1>2</h1></div>
<div class="item"><h1>3</h1></div>
<div class="item"><h1>4</h1></div>
<div class="item"><h1>5</h1></div>
<div class="item"><h1>6</h1></div>
</div>
<!-- jQuery -->
<script src="js/jquery/1.9.1/jquery.min.js"></script>
<!-- Owl Carousel -->
<script src="js/vendors/owl-carousel-2/owl.carousel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var owl = $("#owl-demo");
owl.owlCarousel({
navigation : true,
afterMove : afterMove
});
function afterMove(){
alert("Hey!");
}
});
</script>
</body>
</html>