为什么不能每隔几秒自动轮播

来源:3-6 编程练习

慕慕4033758

2019-03-25 23:12

<!DOCTYPE html>

<html lang="zh-cn">

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

<title>Hello World</title>

<style>

.carousel {

height: 400px;

}

.carousel .item {

height: 400px;

}

.carousel .item img {

width: 100%;

}

</style>

</head>

<body>

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">

<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>

<div class="carousel-inner" role="listbox">

<div class="item active">

<img src="http://img.mukewang.com/5412ad400001e52014280484.jpg" alt="1 slide">

</div>

<div class="item">

<img src="http://img.mukewang.com/5412ad7c0001d2eb10880541.jpg" alt="2 slide">

</div>

<div class="item">

<img src="http://img.mukewang.com/5412ae5c0001653b12800644.jpg" alt="3 slide">

</div>

</div>

<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">

<span class="glyphicon glyphicon-chevron-left"></span>

<span class="sr-only">上一页</span>

</a>

<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">

<span class="glyphicon glyphicon-chevron-right"></span>

<span class="sr-only">下一页</span>

</a>

</div>

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>

<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

</body>

</html>

为什么只有在点击的时候才会换,不像老师的那样每隔几秒就会轮播下一张图片??

写回答 关注

1回答

  • 慕移动8544499
    2019-03-26 19:15:43
    已采纳

    可以的,只是这个页面试不出来

基于bootstrap的网页开发

Bootstrap框架的基础教程,学会用Bootstrap前端框架搭建网页

187669 学习 · 734 问题

查看课程

相似问题