Twitter Bootstrap Carousel不旋转图像

时间:2014-04-10 01:02:15

标签: javascript jquery html twitter-bootstrap

显示活动图像,但之后没有任何反应。我是Bootstrapper的新手,所以我希望有人能告诉我,如果我缺少库,或者语法错误。我环顾四周,一切似乎都是对的?

        <head>
            <meta charset="utf-8">
            <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
            <link rel="stylesheet" href="css/bootstrap-responsive.css">

            <title></title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">

        </head>
        <body>
            <div class="container">
                <div class="navbar navbar-fixed-top">
                    <div class="navbar-inner">
                        <div class="container">
                        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-th-list"></span></a>
                        <a href="#" class="brand">California Autism Center & Learning Group</a>
                        <div class="nav-collapse collapse">
                            <ul class="nav pull-right">
                                <li class="active"><a href="#">Home</a></li>
                                <li><a href="#">About</a></li>
                                <li><a href="#">Contact</a></li>
                                <li><a href="#">Services</a></li>
                                <li><a href="#">Our Staff</a></li>
                            </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="hero-unit">
                    <div id="myCarousel" class="carousel slide">
                        <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>
                        <!-- Carousel items -->
                        <div class="carousel-inner">
                            <div class="active item" alt=""><img src="img/Banner.jpg"/></div>
                            <div class="item" alt=""><img src="img/autism1.jpg"/></div>
                            <div class="item" alt=""><img src="img/autism2.jpg"/></div>
                        </div>
                        <!-- Carousel nav -->
                        <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                        <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span8">
                    <h3>How We Started</h3>
                        <p>Add information here.</p>
                    <h3>Our Goals</h3>
                        <p>Add nformation here.</p>
                    </div>
                </div>
                <hr>
        <div class="container">
        <div class="row-fluid">
            <div class="span4">
                <p>&copy; 2013 <a href="#"></a></p>
            </div>
            <div class="span4 text-center">
                <ul class="nav inline">
                    <li><a href="#">About Us</a></li>
                    <li><a href="#">Contact Us</a></li>
                    <li><a href="#">Privacy Policy</a></li>
                </ul>
            </div>
            <div class="span4 text-right">
                <p></p>
            </div>
        </div>
    </div>

            </div>


            <script src="//code.jquery.com/jquery-1.10.0.min.js"></script>
            <script src=”js/bootstrap.js”></script>
        </body>
    </html>

my .js code:

    $(document).ready(function() {        
            $('#myCarousel').carousel({
                interval: 2000
            })

        });

2 个答案:

答案 0 :(得分:1)

在关闭正文标记之前尝试此操作。它适用于我在BS2&amp ;; 3。

<script>
    $('.carousel').carousel({
    pause:false,
    interval:7000
    })
</script>

答案 1 :(得分:0)

我已经从您的代码中创建了一个Fiddle,它工作正常(除了图像是404占位符这一事实)。我的猜测是问题在于你在这里使用的引用:

<script src=”js/bootstrap.js”></script>

我的Chrome不会将这些视为正常报价,事实上这一行转向:

<script src="”js/bootstrap.js”"></script>