type - 基本层类型

类型:Number,默认:0

layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)。 若你采用layer.open({type: 1})方式调用,则type为必填项(信息框除外)

content - 内容

类型:String/DOM/Array,默认:''

content可传入的值是灵活多变的,不仅可以传入普通的html内容,还可以指定DOM,更可以随着type的不同而不同。

  1. /!*
  2. 如果是页面层
  3. */
  4. layer.open({
  5. type: 1,
  6. content: '传入任意的文本或html' //这里content是一个普通的String
  7. });
  8. layer.open({
  9. type: 1,
  10. content: $('#id') //这里content是一个DOM
  11. });
  12. //Ajax获取
  13. $.post('url', {}, function(str){
  14. layer.open({
  15. type: 1,
  16. content: str //注意,如果str是object,那么需要字符拼接。
  17. });
  18. });
  19. /!*
  20. 如果是iframe层
  21. */
  22. layer.open({
  23. type: 2,
  24. content: 'http://sentsin.com' //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
  25. });
  26. /!*
  27. 如果是用layer.open执行tips层
  28. */
  29. layer.open({
  30. type: 4,
  31. content: ['内容', '#id'] //数组第二项即吸附元素选择器或者DOM
  32. });

layer 中 的type和 content的更多相关文章

  1. Springs Element 'beans' cannot have character [children], because the type's content type is element-only

    Springs Element 'beans' cannot have character [children], because the type's content type is element ...

  2. 万能的ctrl+shift+F(Element 'beans' cannot have character [children], because the type's content type is element-only.错误)

    今天在spring-servlet.xml文件中出现了一个莫名其妙的错误:Element 'beans' cannot have character [children], because the t ...

  3. caffe rpn layer 中的 reshape layer

    Reshape层:(改变blob的形状,N,C,W,H) layer { name: "reshape" type: "Reshape" bottom: &qu ...

  4. Element 'beans' cannot have character [children], because the type's content type is element-only

    这个小问题快搞死我了,找了大半个小时. Element 'beans' cannot have character [children], because the type's content typ ...

  5. Element 'dependencies' cannot have character[children],because the type's content type is elemen

    问题描述: Element 'xxxxxxx' cannot have character [children],because the type's content type is element- ...

  6. Java中primitive type的线程安全性

    Java中primite type,如char,integer,bool之类的,它们的读写操作都是atomic的,但是有几个例外: long和double类型不是atomic的,因为long和doub ...

  7. Scala 深入浅出实战经典 第55讲:Scala中Infix Type实战详解

    王家林亲授<DT大数据梦工厂>大数据实战视频 Scala 深入浅出实战经典(1-64讲)完整视频.PPT.代码下载: 百度云盘:http://pan.baidu.com/s/1c0noOt ...

  8. Struts2 中result type属性说明

    Struts2 中result type属性说明 首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-t ...

  9. ListView中使用type需要注意的东西 java.lang.ArrayIndexOutOfBoundsException: length=2; index=2 addScrapView

    ListView中使用type需要注意的东西 在使用ListView时,如果使用了getItemViewType, 记得他的值一定要是从0开始计数的. 且要覆盖getViewTypeCount方法.并 ...

随机推荐

  1. ethereum/EIPs-191 Signed Data Standard

    https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md eip title author status type category c ...

  2. Emoji表情符号在MySQL数据库中的存储

    文章转自https://www.jianshu.com/p/20740071d854 在Android手机或者iPhone的各种输入法键盘中,会自带一些Emoji表情符号,如IPhone手机系统键盘包 ...

  3. PAT A1107 Social Clusters (30 分)——并查集

    When register on a social network, you are always asked to specify your hobbies in order to find som ...

  4. PAT A1121 Damn Single (25 分)——set遍历

    "Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are suppo ...

  5. Lodop 打印控件

    1.下载 2.使用 一 下载安装控件 官网下载地址:http://www.lodop.net/download.html 参考:http://www.c-lodop.com/demolist/Prin ...

  6. Recurrent Neural Network[CTC]

    0. 背景 1. CTC原理 图 CTC结构图 CTC是看似和HMM有些联系,然后也采用DP来进行求解,将CTC结构图中<RNN输出,CTC层>单独拿出来,得到如下形式: 图 用前向-后向 ...

  7. 微软官方的Excel android 移动版的折腾

    微软官方的Excel android 移动版,有重大bug.害我折腾了一天多时间.最终确认是Excel自身的问题. 现象描述:手机上新建或是保存excel后.放到电脑上,不能打开.提示”Excel在B ...

  8. wpf 状态栏图标背景闪烁提醒 FlashWindowEx

    原文:wpf 状态栏图标背景闪烁提醒 FlashWindowEx using System; using System.Runtime.InteropServices; using System.Wi ...

  9. 深入理解 JS 引擎执行机制(同步执行、异步执行以及同步中的异步执行)

    首先明确两点: 1.JS 执行机制是单线程. 2.JS的Event loop是JS的执行机制,深入了解Event loop,就等于深入了解JS引擎的执行. 单线程执行带来什么问题? 在JS执行中都是单 ...

  10. 浅谈java反射机制

    目录 什么是反射 初探 初始化 类 构造函数 属性 方法 总结 思考 什么是反射 JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意 ...