单击时引导轮播指示灯不会更改照片()

时间:2016-04-03 19:22:52

标签: javascript jquery twitter-bootstrap carousel indicator

我正在尝试编写自举旋转木马,照片会像他们应该的那样自动变化,但是当我试图点击一个时,指示器,旋转木马底部的点不会改变照片。有人可以帮忙吗?我试着到处寻找。

jQuery包含在bootstrap.js之上,但如果是这样,旋转木马不会改变照片,对吗?照片正在改变,但指标不起作用,这很奇怪。

<head>
    <meta charset="utf-8">
    <title>Ag</title>
    <meta name="vievport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
    <script src="bootstrap-3.3.6-dist/js/bootstrap.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.6-dist/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.6-dist/css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/own.css">
</head>
<body>
    <div id="sliderSyrenka" class="carousel slide" data-ride="carousel">
        <!-- INDICATORS-->
        <ol class="carousel-indicators">
            <li data-target="#sliderSyrenka" data-slide-to:"0" class="active"></li> 
            <li data-target="#sliderSyrenka" data-slide-to:"1"></li>
            <li data-target="#sliderSyrenka" data-slide-to:"2"></li>
            <li data-target="#sliderSyrenka" data-slide-to:"3"></li>
        </ol>

        <!-- WRAPPER FOR SLIDES-->
        <div class="carousel-inner" >
            <div class="item active">
                <img src="img/slider/slide0.jpg" alt="" >
            </div>
            <div class="item">
                <img src="img/slider/slide1.jpg" alt="" >
            </div>
            <div class="item">
                <img src="img/slider/slide2.jpg" alt="" >
            </div>
            <div class="item">
                <img src="img/slider/slide3.jpg" alt="" >
            </div>
        </div>
    </div>
</body>

1 个答案:

答案 0 :(得分:1)

您在data-slide-to:

中遇到语法错误

只需将:替换为=,轮播指示符就可以完美运行:)

更正carousel-indicators

<!-- INDICATORS-->
    <ol class="carousel-indicators">
        <li data-target="#sliderSyrenka" data-slide-to="0" class="active"></li> 
        <li data-target="#sliderSyrenka" data-slide-to="1"></li>
        <li data-target="#sliderSyrenka" data-slide-to="2"></li>
        <li data-target="#sliderSyrenka" data-slide-to="3"></li>
    </ol>