当我点击旋转木马左右按钮时,我总是被定向到另一个页面(登录页面)。我可以单击小按钮导航到其他幻灯片,但不能通过按钮导航。我不确定为什么会变成这样。
应用程序.js
.state('home', {
url: '/home',
templateUrl: 'views/home.html',
controller: 'HomeController'
})
index.html
<li>
<a ui-sref="home" ui-sref-active="active">Home</a>
</li>
home.html
<section>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="/img/ibm.png" alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="/img/ibm.png" alt="...">
<div class="carousel-caption">
...
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>
最佳答案
这通常发生在像这样在 Bootstrap 文件之后加载 JQuery 文件时
<script src="/js/bootstrap.min.js"></script>
<script src="/js/jquery-2.1.4.min.js"> </script>
它应该首先加载 JQuery,而不是像这样加载 Bootstrap。
<script src="/js/jquery-2.1.4.min.js"> </script>
<script src="/js/bootstrap.min.js"></script>
检查一下,如果不是这种情况,则必须进行更深入的研究。
你也可以在这里找到一些有用的答案
关于javascript - 单击轮播按钮时重定向到另一个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37202591/