Bootstrap每天必学之模态框(Modal)插件_javascript技巧

WBOY
Release: 2016-05-16 15:03:42
Original
1550 people have browsed it

本节课我们主要学习一下 Bootstrap 中的模态框插件, 这是一款交互式网站非常常见的弹窗功能插件。

一.基本使用
使用模态框的弹窗组件需要三层 div 容器元素,分别为 modal(模态声明层)、
dialog(窗口声明层)、content(内容层)。在内容层里面,还有三层,分别为 header(头部)、body(主体)、footer(注脚)。
//基本实例

 
Copy after login

如果想让模态框自动隐藏,然后通过点击按钮弹窗,那么需要做如下操作。

//模态框去掉 show,增加一个 id 
Copy after login

二.用法说明
基本使用介绍结束之后,我们就来看下插件的各种重要用法。所有的插件,都是基于JavaScript/jQuery 的。那么,就有四个要素:用法、参数、方法和事件。
1.用法
第一种:可以通过 data 属性

//data-toggle data-toggle="modal" data-target="#myModal"
Copy after login

data-toggle 表示触发类型
data-target 表示触发的节点

如果不是使用

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!