Bootstrap 轮播图的使用和理解
<!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">
<title>Bootstrap 轮播图</title>
<link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]--> <style>
img {
width: 100%;
height: 100%;
}
p {
text-align: center;
}
</style>
</head>
<body>
<!-- 轮播图部分 -->
<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="data:images/轮播1.png" alt="轮播图1">
<div class="carousel-caption">
轮播图1
</div>
</div>
<div class="item">
<img src="data:images/轮播2.png" alt="轮播图2">
<div class="carousel-caption">
轮播图2
</div>
</div>
<div class="item">
<img src="data:images/轮播3.png" alt="轮播图3">
<div class="carousel-caption">
轮播图3
</div>
</div>
<p>轮播图尝试</p>
</div> <!-- Controls -->
<!-- 控制 -->
<!-- 向左滑动 -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="false"></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> <!-- js控制轮播图 -->
<button id="prev">向前</button>
<button id="next">向后</button>
<button id="pause">停止</button>
<button id="start">开始</button>
<button id="jump">到第二张</button> <script src="lib/jquery/jquery.js"></script>
<script src="lib/bootstrap/js/bootstrap.js"></script>
<!-- 轮播图还支持js控制 -->
<script>
$(function(){
$('.carousel').carousel({
interval: 2000,//轮播间隔
pause:"hover", //鼠标悬停在轮播图上,是否停止滚动
wrap:true, //
keyboard:true //响应键盘事件
}); $("#prev").click(function(event) {
$('.carousel').carousel('prev')// 周期上一个项目。
}); $("#next").click(function(event) {
$('.carousel').carousel('next')// 周期到下一个项目。
});; $("#pause").click(function(event) {
$('.carousel').carousel('pause')// 从通过项目循环停止传送带。
});; $("#start").click(function(event) {
$('.carousel').carousel('cycle')// 通过传送带项目周期从左到右。
});; $("#jump").click(function(event) {
$('.carousel').carousel(1)// 循环传送带到一个特定的帧(0为主,类似于数组)。
});; });
</script>
</body>
</html>
注意引入.css和.js 文件查看效果(里面有三张图片,随便找几张代替便可)
Bootstrap 轮播图的使用和理解的更多相关文章
- Bootstrap 我的学习记录4 轮播图的使用和理解
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8& ...
- bootstrap轮播图 两侧半透明阴影
用bootstrap轮播图:Carousel插件,图片两侧影音实在碍眼,想去掉,首先发现有css里由opacity: 0.5这个东西来控制,全部改成opacity: 0.0,发现指示箭头也看不见了. ...
- bootstrap轮播图--兼容IE7
<!DOCTYPE html> <html> <head> <title>Bootstrap轮播</title> <meta char ...
- 动态请求数据并放入bootstrap轮播图
下面是前端代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...
- 第124天:移动web端-Bootstrap轮播图插件使用
Bootstrap JS插件使用 > 对于Bootstrap的JS插件,我们只需要将文档实例中的代码粘到我们自己的代码中> 然后作出相应的样式调整 Bootstrap中轮播图插件叫作Car ...
- bootstrap轮播图组件
一.轮播图组件模板(官方文档) <div id="carousel-example-generic" class="carousel slide" dat ...
- bootstrap轮播图
<!doctype html><html><head> <meta charset="utf-8"> <title>使用 ...
- Bootstrap 轮播图(Carousel)插件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- bootstrap轮播图不能显示左右箭头
引入font文件夹即可 原文 :http://www.imooc.com/qadetail/64277
随机推荐
- stylus , another css processor
1. install from npm sudo npm install stylus 2. create a styl file named step1.styl border-radius() { ...
- [WebService] 使用httpWebrequest 调用并调试WebService
使用httpWebrequest 调用并调试WebService. 首先 使用httpWebrequest 调用WebService 代码: using System.Net; ...
- 成都Uber优步司机奖励政策(3月19日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- CLR via c#读书笔记六:参数
注:书本第9单参数 CLR默认所有方法参数都传值.引用本身是值引的,意味左方法能修改对象,而调用都能看到这些修改.值类型,传的是实例的一个副本,所以调用者不受影响. (和以前理解的不一样.默认都是传值 ...
- spring-boot、mybatis整合
一.MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以使用简单的 X ...
- 鸡啄米:C++编程之十四学习之构造函数和析构函数
1. 本人学习鸡啄米课程的笔记记录,用来记录学习的历程和进度 2. 构造函数 我们在声明一个变量时,如果对它进行了初始化,那么在为此变量分配内存空间时还会向内存单元中写入变量的初始化.声明对象有相似的 ...
- C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 – 员工离职管理
C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 – 员工离职管理 当公司有几万人,上千家加盟网点,几个庞大的直属分公司后,系统账户的有效管理也是一个头疼的问题,把所有的帐户及时进行科学 ...
- 对JSON的理解
JSON语法: JSON是一种结构化数据,它是一种数据格式 JSON可以概括为三种类型:简单值.对象.数组 注意:JSON不支持变量.函数和对象实例 一.JSON简单值 包括字符串.数值.布尔值.和n ...
- tpo-08 C1 submit a document for graduation
第 1 段 1.Listen to a conversation between a student and a registrar. 请听一段学生和老师的对话. 第 2 段 1.Hi, I'd li ...
- lintcode142 O(1)时间检测2的幂次
O(1)时间检测2的幂次 用 O(1) 时间检测整数 n 是否是 2 的幂次. 您在真实的面试中是否遇到过这个题? Yes 样例 n=4,返回 true; n=5,返回 false. 二进制的n中只有 ...