Bootstrap自带的那些常用插件。

模态框

模态框的HTML代码放置的位置

务必将模态框的HTML代码放在文档的最高层级内(也就是说,尽量作为 body 标签的直接子元素),以避免其他组件影响模态框的展现和/或功能。

HTML代码:

<!-- 触发模态框的按钮 -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button> <!-- 模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

注意:

  • 通过为模态框设置 .bs-example-modal-lg.bs-example-modal-sm来控制模态框的大小。
  • 通过 .fade类来控制模态框弹出时的动画效果(淡入淡出效果)。
  • 通过在 .modal-bodydiv中设置 .row可以使用Bootstrap的栅格系统。

调用方式:

1.通过data属性

通过在一个触发弹出模态框的元素(例如:按钮)上添加 data-toggle="modal"属性,然后设置 data-target="#foo"属性或 href="#foo"属性,用来指向被控制的模态框。

<button type="button" data-toggle="modal" data-target="#myModal">显示模态框</button>

2.通过JS代码调用

$('#myModal').modal("show");  // 显示
$('#myModal').modal("hide") // 隐藏

常用参数:

名称 可选值 默认值 描述
backdrop true/false/'static' true false表示有没有遮罩层,'static'表示点击遮罩层不关闭模态框
keyboard true/false true 键盘上的 esc 键被按下时关闭模态框。
show true/false true 模态框初始化之后就立即显示出来。

方法:

$('#myModal').modal({
keyboard: false
})

轮播图

HTML代码:

<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="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div> <!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></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>

可以在为图片添加介绍信息:

<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
<h3>...</h3>
<p>...</p>
</div>
</div>

方法:

设置切换间隔为2秒,默认是5秒。

$('.carousel').carousel({
interval: 2000
})
 
 
 

Bootstrap常用的自带插件的更多相关文章

  1. BootStrap常用组件及响应式开发

    BootStrap常用组件 PS:所有的代码必须写在<class="container/container-fluid">容器当中 常用组件包含内容: 字体图标 下拉菜 ...

  2. Sublime Text 常用快捷键和优秀插件

    SublimeText3常用快捷键和优秀插件 SublimeText是前端的一个神器,以其精简和可DIY而让广大fans疯狂.好吧不吹了直入正题 -_-!! 首先是安装,如果你有什么软件管家的话搜一下 ...

  3. SublimeText3常用快捷键和优秀插件

    SublimeText3常用快捷键和优秀插件 SublimeText是前端的一个神器,以其精简和可DIY而让广大fans疯狂.好吧不吹了直入正题 -_-!! 首先是安装,如果你有什么软件管家的话搜一下 ...

  4. SublimeText3常用快捷键和优秀插件(亲测)

    SublimeText3常用快捷键和优秀插件 SublimeText是前端的一个神器,以其精简和可DIY而让广大fans疯狂.好吧不吹了直入正题 -_-!! 首先是安装,如果你有什么软件管家的话搜一下 ...

  5. IDEA常用设置及推荐插件

    IDEA常用设置及推荐插件 本文主要记录IDEA的一些常用设置,IDEA与Eclipse的常用快捷键对比及推荐一些好用的插件. 基本设置 设置界面风格及修改外部UI尺寸大小 打开IDEA时设置不重新打 ...

  6. 自己写的基于bootstrap风格的弹框插件

    自己写的一款基于bootstrap风格的弹框插件,暂时只有确认框.提示框.后续功能扩展.bug修改再更新. ;(function($){ //默认参数 var PARAMS; var DEFAULTP ...

  7. angularjs封装bootstrap官网的时间插件datetimepicker

    背景:angular与jquery类库的协作 第三方类库中,不得不提的是大名鼎鼎的jquery,现在基本上已经是国内web开发的必修工具了.它灵活的dom操作,让很多web开发人员欲罢不能.再加上已经 ...

  8. bootstrap - typeahead自动补全插件

    $('#Sale').typeahead({ ajax: { url: '@Url.Action("../Contract/GetSale")', //timeout: 300, ...

  9. 第二百四十五节,Bootstrap标签页和工具提示插件

    Bootstrap标签页和工具提示插件 学习要点: 1.标签页 2.工具提示 本节课我们主要学习一下 Bootstrap 中的标签页和工具提示插件. 一.标签页选项卡 标签页也就是通常所说的选项卡功能 ...

随机推荐

  1. OpenCV图像平移

    图像平移是将图像的所有像素坐标进行水平或垂直方向移动,也就是所有像素按照给定的偏移量在水平方向上沿x轴.垂直方向上沿y轴移动.这种操作分为两种,一种是图像大小不改变,这样最后原图像中会有一部分不在图像 ...

  2. 使用青花瓷(charles)抓包

    官网下载charles: https://www.charlesproxy.com/download/ MAC & Apple 打开青花瓷charles 找到本地IP:青花瓷里面Help-&g ...

  3. RAID冗余磁盘阵列的创建

    RAID 0 :条带化,数据被拆分到多个驱动中,写速度最快,但并没有数据镜像或校验信息. RAID 1 :镜像化,完全磁盘镜像,在独立磁盘上创建数据的两份拷贝,这个级别提供最好的数据安全,但写速度慢. ...

  4. 【并行计算-CUDA开发】GPU 的硬体架构

    GPU 的硬体架构   这里我们会简单介绍,NVIDIA 目前支援CUDA 的GPU,其在执行CUDA 程式的部份(基本上就是其shader 单元)的架构.这里的资料是综合NVIDIA 所公布的资讯, ...

  5. 【VS开发】VS2010中导入ActiveX控件

    方法1: 1.首先在在项目上面右击添加类,如下图所示: 2.点击添加ActiveX控件中的MFC类 3.找到需要添加的ActiveX类. 4.点击完成即可. 5.此时转到资源视图,打开如下视图.可能工 ...

  6. Linux第三阶段题型测试

    1.如何取得/etiantian文件的权限对应的数字内容,如-rw-r--r--为644,要求使用命令取得644或0644这样的数字. 解答: 1)最土的方法:ls -l /etiantian |cu ...

  7. Confluence与Jira安装及后期迁移问题记录

    Confluence与Jira 由于线上jira和confluence之前互相关联,confluence的登录用户全部关联自jira的用户,confluence安装时会提示是否关联jira,由于这个问 ...

  8. Linux Pycharm 添加图标到root账户桌面

    1. 去官网下载pycharm程序 2. 解压缩下载到的tar包 3. 在/usr/share/applications目录下新建一个pycharm.desktop, 写入内容如下, 注意红色字体需要 ...

  9. BigData进阶--Spark中的函数与符号

    转自:https://blog.csdn.net/YSC1123/article/details/78905090 1.Character.isDigit() 判断是否为数字 2.Character. ...

  10. 技能节-AI人脸识别

    我们收到技能节项目的通知是在两周之前,项目要求做个人脸评分系统. 两周时间写一个"人脸评分系统",好像时间比较紧了,还好我们完成了~这个项目是将摄像头捕获到的包含人脸的图像传输到百 ...