我有一个SpringBoot + Thymeleaf + Bootstrap Web应用程序,我在主页面上有一个Bootstrap Carousel。当我静态加载它时,旋转木马工作正常但是当我在SpringBoot / Thymeleaf环境中运行它时,它不会在图像之间旋转,左/右控制也不起作用。
HTML / Thymeleaf:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="user-scalable=yes,width=device-width, initial-scale=1"></meta>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" data-th-src="@{/webjars/jquery/3.2.1/jquery.min.js}"></script>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link> -->
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" data-th-href="@{/webjars/bootstrap/css/bootstrap.min.css}" />
<link rel="stylesheet" type="text/css" media="screen" href="../static/css/main.css" data-th-href="@{/css/main.css}" />
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
<script type='text/javascript' src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" data-th-src="@{/webjars/bootstrap-3.2.0/js/bootstrap.min.js}"></script>
</head>
<div id="pictureCarousel" class="carousel slide" data-ride="carousel" data-interval="10000" data-pause="null" style="width:100%;height:auto;margin:auto;background-size:contain;display: block;">
<ol class="carousel-indicators">
<li data-target="#pictureCarousel" data-slide-to="0" class="active"></li>
<li data-target="#pictureCarousel" data-slide-to="1"></li>
<li data-target="#pictureCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="active item">
<img src="../static/images/pic1" th:src="@{/images/pic1}" alt="Pic1" style="width:100%;height: 500px;"></img>
<div class="carousel-caption">
<p>Pic1</p>
</div> <!--height="396.5px" width="1024px"> -->
</div>
<div class="item">
<img src="../static/images/pic2" th:src="@{/images/pic2}" alt="Pic2" style="width:100%;height: 500px;"></img><!--height="396.5px" width="1024px"> -->
<div class="carousel-caption">
<p>Pic2</p>
</div>
</div>
<div class="item">
<img src="../static/images/pic3" th:src="@{/images/pic3}" alt="pic3" style="width:100%;height: 500px;"></img> <!--height="396.5px" width="1024px"> -->
</div>
</div>
<a class="left carousel-control" href="#pictureCarousel" role="button" data-slide="prev">
<span class="icon-prev" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#pictureCarousel" data-slide="next">
<span class="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
有什么想法吗?