Bootstrap Carousel不能在Google Chrome中工作

Bootstrap Carousel won't work in Google Chrome

本文关键字:Chrome 工作 Google Carousel 不能 Bootstrap      更新时间:2023-09-26

在过去的几周里,我一直在使用carousel bootstrap插件,没有任何问题。就在最近,这种做法行不通。我在火狐上试过,效果很好。我看到这个问题,并尝试了所有建议,它仍然不起作用。我已经删除了所有不同的脚本和css导入,并尝试只让carousel工作,它仍然不工作。

这是我的carousel代码:

        <!-- Ad Carousel -->
    <div id="ad_carousel" class="carousel slide" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#ad_carousel" data-slide-to="0" class="active"></li>
            <li data-target="#ad_carousel" data-slide-to="1"></li>
            <li data-target="#ad_carousel" data-slide-to="2"></li>
        </ol>
        <!-- Wrapper for slides -->
        <div class="carousel-inner">
            <div class="item active">
                <img src="images/ads/33.jpg">
            </div>
            <div class="item">
                <img src="images/ads/55.jpg">
            </div>
            <div class="item">
                <img src="images/ads/77.jpg">
            </div>
        </div>
        <!-- Controls -->
        <a class="left carousel-control" href="#ad_carousel" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a class="right carousel-control" href="#ad_carousel" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
    </div>

除了这些:

<link rel="stylesheet" href="plugins/bootstrap_3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="plugins/bootstrap_3.1.1/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="plugins/bootstrap_3.1.1/css/theme.css">
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
<script src="plugins/bootstrap_3.1.1/js/bootstrap.min.js"></script>

这个插件以前工作得很好,没有任何问题,但就在今天,没有改变任何东西,不管我做什么,它不会在谷歌浏览器工作。我不知道是不是Chrome的更新搞砸了什么,但我不确定发生了什么。

我在网上查了一下,除了上面提到的一个问题外,没有发现任何类似的问题。

是什么让这个插件不工作?如何才能解决这个问题,使这个插件再次在Chrome中工作?

EDIT:与此同时,我没有得到控制台错误。

EDIT2:所以我已经把它缩减到我认为的问题所在。这是src链接的图像。我复制并粘贴了舍伍德的旋转木马的jsfiddle代码(在评论)到我的网页。对于他的图片,他使用了一些猫图片的链接。当我使用他的代码时,它工作得很好,但是当我试图使用服务器上的一些图像时,它又不起作用了。使用Chrome的web开发工具,我查看了框架的资源。carousel中的图像不被认为是"图像"(或者至少它们不包含在images文件夹中)。它们在"其他"文件夹中。他们仍然是一个.jpg文件,但Chrome看到他们(从资源和元素的角度来看)作为一个空白的图像与0宽度和0高度(0px x 0px)。当我双击资源中的图像时,Chrome会在另一个窗口打开图像,并显示它很好。

这完全把我难住了,我不知道发生了什么事。我试过许多不同的方法,但似乎都不管用。有什么建议吗?

可能是你应该禁用所有的谷歌Chrome扩展?他们可能会导致bug,因为他们在每个html页面中添加了自己的javascript和样式…

您的控制台是否抛出任何错误?