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自带的那些常用插件. 模态框 模态框的HTML代码放置的位置 务必将模态框的HTML代码放在文档的最高层级内(也就是说,尽量作为 body 标签的直接子元素),以避免其他组件影响模态 ...

  2. Bootstrap自带的那些常用插件

    1.Bootstrap自带的那些常用插件. 1.1模态框 模态框的HTML代码放置的位置 务必将模态框的HTML代码放在文档的最高层级内(也就是说,尽量作为 body 标签的直接子元素),以避免其他组 ...

  3. 前端与php的sublime text3常用插件

    sublime text各种版本下载:http://sublimetext.iaixue.com/dl/ 1.安装Package Control 快捷键: ctrl+`     粘贴内容后Enter: ...

  4. Twitter Bootstrap JavaScript插件

    Twitter Bootstrap JavaScript插件本文收集了10款非常不错的JavaScript Twitter bootstrap扩展插件,利用Boostrap开发者可以节省大量的时间修复 ...

  5. Bootstrap分页插件ajax返回数据,工具类的编写

    使用Bootstrap分页插件时,需要返回指定的参数,这样Bootstrap才能够识别 需要引入的css: <!-- boostrap table --> <link href=&q ...

  6. VSCode之快捷键和常用插件

    前言 介绍一下我在VSCode中常用的一些快捷方式: ctrl+上下箭头 上下滚动页面 Ctrl+Shift+K 删除某一行 Alt+ ↑ / ↓ 移动某一行 Shift+Alt + ↓ / ↑ 复制 ...

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

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

  8. Visual Studio Code 常用插件整理

    常用插件说明: 一.HTML Snippets 超级使用且初级的H5代码片段以及提示 二.HTML CSS Support  让HTML标签上写class智能提示当前项目所支持的样式 三.Debugg ...

  9. CDN公共库、前端开发常用插件一览表(VendorPluginLib)

    =======================================================================================前端CDN公共库===== ...

随机推荐

  1. ARTS打卡计划第十二周

    Algorithms: https://leetcode-cn.com/problems/balanced-binary-tree/ 平衡二叉树. Review:  “What I Learned i ...

  2. Leetcode题目分类整理

    一.数组 8) 双指针 ---- 滑动窗口 例题: 3. Longest Substring Without Repeating Characters 描述:Given a string, find ...

  3. 【Docker】docker 的常用命令&操作

    一.在linux虚拟机上安装docker XShell1:检查内核版本,必须是3.10及以上 uname -r2:安装docker yum install docker3:输入y确认安装4:启动doc ...

  4. Linux设备驱动程序 之 主次设备号

    主设备号和次设备号 对字符设备的访问是通过文件系统内的设备名称进行的,这些名称被称为特殊文件.设备文件.或者简单称之为文件系统树的节点,它们通常位于/dev目录.字符设备驱动程序的设备文件可以通过ls ...

  5. 面试题:this指针的指向,以及call、apply应用

    var a = 2; function test(){ var a = 4; console.log(this.a); this.a = 1; } test();//2 //这里为什么是2?因为调用t ...

  6. 更新ubuntu的对应源配置文件

    UBUNTU中安装依赖包,出现如下错误:E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/o ...

  7. laravel-5.3(1) 路由配置

    第一步: 按照上一篇搭建好工程后可以看到框架默认的 welcome 默认视图: 一般的web 开发框架是MVC设计模式,那么我们现在创建自己的控制器和视图,CMD 进入到工程根目录执行 php art ...

  8. mac中的word内容丢失

    改了一晚上好不容易快搞完了,结果1万字的内容丢了,并且不知道自己当时怎么想的还清理了回收站 还是用mac自带的工具吧,同时代码也要及时上传github

  9. mysql的启动问题

    用cmd启动MySQL   (net start mysql )时出现(发生系统错误 5.  拒绝访问)这样的错误是因为cmd 权限太低了需要提高cmd权限才行(即使管理员权限) 如下图cmd所示: ...

  10. SpringCloud(五)之Spring Cloud 中 Feign结合Hystrix断路器开发实战

    1.先讲hystrx(断路器) 在springcloub 中的使用 1.1  加入依赖 注意:网上新旧版本问题,所以要以官网为主,不然部分注解会丢失最新版本 2.0 <dependency> ...