我从Bootstrap页面复制这个轮播代码,然后我编辑轮播的内容。
但是控制器不起作用 即使我在“div”元素内移动控制器。
(但如果我在只有轮播的空白页面上进行测试,它就有效。)
当我在工作页面中测试此代码时,它们无法正常工作
这是我的代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<title>Thai Chiang Mai</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<!-- Custom fonts for this template -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="jquery-3.2.1.min.js">
</head>
<body>
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="img/food/bonchon.jpg" alt="bonchon" style="width:100%;" class="img-responsive">
</div>
<div class="item">
<img src="img/food/green_curry.jpeg" alt="Curry" style="width:100%;" class="img-responsive">
</div>
<div class="item">
<img src="img/food/kai.jpg" alt="Kai" style="width:100%;" class="img-responsive">
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
答案 0 :(得分:0)
在结束body标签之前使用js和jquery。 并使用单个框架。你正在使用两个w3和bootstrap。