我已经尝试为我的网站实现一个旋转木马5个小时了。我想要显示多个图像,但每次递增轮播1个图像。我试着在youtube https://www.youtube.com/watch?v=nVNv1jUitCk上关注这个教程,直到4:45。除了“上一步”和“下一步”按钮不显示外,一切都显示得很好。我确信Javascript不能在我的系统上工作,但这可能是另一个问题。这是我的第五个教程。另外,我不知道如何链接这里的owl库,因为它被下载到我的本地计算机上。
观看了多个教程并搜索了堆栈溢出
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- <link rel="stylesheet" type="text/css" href="../static/css/base.css"> -->
<!-- linking the owl carousel files -->
<link rel="stylesheet" href="../static/css/owl.carousel.css">
<link rel="stylesheet" href="../static/css/owl.theme.default.css">
<title>Carousel Demo</title>
</head>
<body>
<!-- carousel -->
<div class="container mt-5">
<div class="row">
<div class="owl-carousel owl-theme">
<div class="item"><h4>1</h4></div>
<div class="item"><h4>2</h4></div>
<div class="item"><h4>3</h4></div>
<div class="item"><h4>4</h4></div>
<div class="item"><h4>5</h4></div>
<div class="item"><h4>6</h4></div>
<div class="item"><h4>7</h4></div>
<div class="item"><h4>8</h4></div>
<div class="item"><h4>9</h4></div>
<div class="item"><h4>10</h4></div>
<div class="item"><h4>11</h4></div>
<div class="item"><h4>12</h4></div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- linking owl js here -->
<script src="../static/js/owl.carousel.js"></script>
<!-- owl setup script -->
<script>
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:true,
responsive:{
0:{
items:1
},
600:{
items:3
},
1000:{
items:5
}
}
})
</script>
</body>
</html>
预期的结果应该是一个具有两个按钮的旋转木马,next和prev,这两个按钮实际工作。
发布于 2019-05-23 02:47:46
我刚刚尝试使用您提供的HTML代码加载Owl-Carousel,它工作正常(我调整了文件路径以匹配我自己的路径)。但是,如果您没有正确链接您的文件,则可能无法正确加载某些组件(如本例中的箭头)。
如果您打开开发工具并前往“控制台”,您是否在那里看到任何错误消息?这将为您提供可能未正确加载的线索。
https://stackoverflow.com/questions/56262574
复制相似问题