1、simplemodal在内部定义了如下css类

simplemodal-overlay:遮罩

simplemodal-container:弹出窗口容器

simplemodal-wrap

simplemodal-data

2、关闭窗口

simplemodal自动为弹出窗口内class是“simplemodal-close”的元素绑定了关闭函数。故,只要添加这个类就可以关闭功能。

也可以调用$.modal.close()的方式关闭打开的弹出窗口。

如果不想用插件内定的class名称为关闭函数类,可以自定义,方法如下:

$.modal.defaults.closeClass = "modalClose";

当然,如果想修改多个默认参数,可以使用如下代码:

$.extend($.modal.defaults,{

  closeClass:"modalClose",

  closeHTML:"<a href='#'>Close</a>"

});

3、现在看看它的自定义选项:
appendTo :将弹出框添加到的父容器,参数为css选择器
opacity :透明度
overlayId :遮罩层id
overlayCss :{Object}定义遮罩层样式
containerId :弹出窗体容器id
containerCss :定义容器的样式
dataId :内容层id
containerCss :内容层的样式
minHeight :最小高度
minWidth :最小宽度
maxHeight :最大高度maxWidth :最大宽度
autoResize:是否自适应大小
zIndex :弹出层的z-index
close :是否允许关闭
closeHTML :自定义关闭按钮
closeClass :关闭层样式
overlayClose :点击遮罩层是否关闭弹出窗体
position :数组 [top, left] 自定义弹出窗体位置
onOpen :弹出窗体打开时候的回调函数
onShow :弹出窗体显示时候的回调函数
onClose :弹出窗体关闭时候的回调函数

Options

The following is a list of current options. Default values are indicated with: [Type:Value]

    • appendTo [String:'body']
      The jQuery selector to append the elements to. For ASP.NET, use 'form'.
    • focus [Boolean:true] (Changed in 1.4)
      Focus in the first visible, enabled element?
    • opacity [Number:50]
      The opacity value for the overlay div, from 0 - 100
    • overlayId [String:'simplemodal-overlay']
      The DOM element id for the overlay div
    • overlayCss [Object:{}]
      The CSS styling for the overlay div
    • containerId [String:'simplemodal-container']
      The DOM element id for the container div
    • containerCss [Object:{}]
      The CSS styling for the container div
    • dataId [String:'simplemodal-data']
      The DOM element id for the data div
    • dataCss [Object:{}]
      The CSS styling for the data div
    • minHeight [Number:null]
      The minimum height for the container
    • minWidth [Number:null]
      The minimum width for the container
    • maxHeight [Number:null]
      The maximum height for the container. If not specified, the window height is used.
    • maxWidth [Number:null]
      The maximum width for the container. If not specified, the window width is used.
    • autoResize [Boolean:false] (Changed in 1.4)
      Resize the container if it exceeds the browser window dimensions?
    • autoPosition [Boolean:true] (Changed in 1.4)
      Automatically position the container upon creation and on window resize?
    • zIndex [Number: 1000]
      Starting z-index value
    • close [Boolean:true]
      If true, closeHTMLescClose and overClose will be used if set. If false, none of them will be used.
    • closeHTML [String:'']
      The HTML for the default close link. SimpleModal will automatically add the closeClass to this element.
    • closeClass [String:'simplemodal-close']
      The CSS class used to bind to the close event
    • escClose [Boolean:true]
      Allow Esc keypress to close the dialog?
    • overlayClose [Boolean:false]
      Allow click on overlay to close the dialog?
    • position [Array:null]
      Position of container [top, left]. Can be number of pixels or percentage
    • persist [Boolean:false]
      Persist the data across modal calls? Only used for existing DOM elements. If true, the data will be maintained across modal calls, if false, the data will be reverted to its original state.
    • modal [Boolean:true] (Added in 1.3.4. Name changed from transient in 1.3.5))
      User will be unable to interact with the page below the modal or tab away from the dialog. If false, the overlay, iframe, and certain events will be disabled allowing the user to interact with the page below the dialog.
    • onOpen [Function:null]
      The callback function used in place of SimpleModal's open
    • onShow [Function:null]
      The callback function used after the modal dialog has opened
    • onClose [Function:null]
      The callback function used in place of SimpleModal's close

jQuery插件之simplemodal的更多相关文章

  1. 第7章 jQuery插件的使用和写法

    第7章 jQuery插件的使用和写法 插件又称扩展,是一种遵循一定规范的应用程序接口写出来的程序. 插件的编写思想基于面向对象. 获取最新的插件可以查看jquery官网:http://plugins. ...

  2. jquery插件库

    jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多javascript高手加入其team. jQuery是继prototype之后又一个优秀的Javascrīpt框架.其经典 ...

  3. 强烈推荐240多个jQuery插件提供下载

    jQuery 是继 prototype 之后又一个优秀的 Javascript 框架.其宗旨是—写更少的代码,做更多的事情.它是轻量级的 js 库(压缩后只有21k) ,这是其它的 js 库所不及 的 ...

  4. 240多个jQuery插件

    概述 jQuery 是继 prototype 之后又一个优秀的 Javascript 框架.其宗旨是—写更少的代码,做更多的事情.它是轻量级的 js 库(压缩后只有21k) ,这是其它的 js 库所不 ...

  5. 海量jQuery插件

    转自:http://blog.csdn.net/zzq58157383/article/details/6900142 提醒大家在使用的时候注意jQuery包的版本问题,最好是使用相同的版本,因为使用 ...

  6. jquery插件下载地址

    以下是本人收集的jquery插件下载地址: .............版本自行选择. jquery官网:http://jquery.com/ jquery.validate.js 官网下载地址:htt ...

  7. 转 常用JQuery插件整理

    虽然自己也写过插件,但JQuery插件种类的繁多,大多时候,我还是使用别人写好的插件,这些都是我用了同类插件里较为不错的一些,今天就整理一下公开放出来. UI: jquery.HooRay(哈哈,自己 ...

  8. 转 jquery插件--241个jquery插件—jquery插件大全

    241个jquery插件—jquery插件大全 jquery插件jqueryautocompleteajaxjavascriptcoldfusion jQuery由美国人John Resig创建,至今 ...

  9. jquery插件推荐

    jQuery 是继 prototype 之后又一个优秀的 Javascript 框架.其宗旨是—写更少的代码,做更多的事情.它是轻量级的 js 库(压缩后只有21k) ,这是其它的 js 库所不及的, ...

随机推荐

  1. Python核心编程第三版第二章学习笔记

    第二章 网络编程 1.学习笔记 2.课后习题 答案是按照自己理解和查阅资料来的,不保证正确性.如由错误欢迎指出,谢谢 1. 套接字:A network socket is an endpoint of ...

  2. sql练习

  3. SQL Server 2012 学习笔记4

    1.  约束 , 给某些字段添加约束条件, 比如年龄在1-100岁之间 添加约束,输入 Age>1 and Age < 100 2.  存储过程 存储过程也可以做增删改查    存储过程的 ...

  4. 使用js进行string和json之间转换的方法

    在数据传输过种中,json是以文本,即字符串的形式传递,字符串形似Json对象: var str1 = '{ "name": "Amy", "sex& ...

  5. DataReader和DataSet的异同

    DataReader:使用时始终占用SqlConnection,在线操作数据库:每次只在内存中加载一条数据,所以占用的内存是很小的:是只进的. 只读的. DataSet:则是将数据一次性加载在内存中. ...

  6. electron打包

    1.全局安装electron-packager npm install -g electron-packager 2.在项目目录下执行命令 electron-packager ./ --platfor ...

  7. HTML学习笔记——图片显示、图片跳转、图片相对路径

    1>显示图片.用a标签实现点击图片跳转.地图标签/点击图片上固定区域跳转 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transit ...

  8. Interesting things in Unity 4.5 you probably didn't know about

    http://va.lent.in/interesting-things-in-unity-4-5-you-probably-didnt-know-about/

  9. Webpack 之 Loader 的使用

    安装 loaders 如果loader在npm里,可以这样安装: $ npm install xxx-loader --save 或者 $ npm install xxx-loader --save- ...

  10. My VA Snippet

    My VA snippet Visual Assist X 是一款比较好用的编码辅助工具, 这款工具可以大大提高程序员的编码速度和开发效率.同时在它的指引下可以有效避免低级Bug. 真正实现快速编码, ...