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. <mvc:annotation-driven />注解意义(转)

    文章转自http://elf8848.iteye.com/blog/875830 http://www.cnblogs.com/shuo1208/p/5552134.html 暂时只知道对json的支 ...

  2. Struts 2.5.20 在Eclipse IDE中的配置和开发实例

    零.参考博客1.Struts框架入门教程2.Struts 2.5.10.1配置 3.eclipse中搭建Struts2.5.16 4.Struts2.5+eclipse+tomcat8.5配置 注意: ...

  3. Linux kernel Programming - Concurrency and Race Conditions

    Concurrency and Its Management Race condition can often lead to system crashes, memory leak,corrupte ...

  4. QT pro文件详细写法+实例

    很多的初学者都没有注意pro 文件的内容 今天简单的介绍一下 这个文件主要内容 TEMPLATE:这个变量是用来定义你的工程将被编译成什么模式.如果没有这个设置,系统将默认编译为application ...

  5. java 数据类型和运算符

    1.注释 单行注释:  //哈哈哈 多行注释: /* 啦啦啦 */ 文档注释: /**    */注释中包含一些说明性的文字及一些JavaDoc标签(后期写项目时,可以生成项目的API)        ...

  6. Linux命令——find/grep

    这两个命令写起来会很多,这里只简单的写一些东西,加深自己的印象. 一.find find命令主要作用是沿着文件层次结构向下遍历,匹配符合条件的文件,并执行相应的操作. 1)命令格式 find [参数] ...

  7. Linux命令——head/tail

    一.head head主要是用来显示档案的开头至标准输出中,默认打印相应文件的开头10 行. 1)命令格式 head [参数] [文件] 2)常用参数 -q     隐藏文件名-v     显示文件名 ...

  8. TerraExplorer Add-ons 和TEZ使用说明

    1.    概述 Skyline提供了丰富的API,用户可以根据不同实际需求,进行二次开发封装,实现各种功能的扩展和定制.当我们开发了各种功能页面或者应用程序后,如何将它们快速嵌入到TerraExpl ...

  9. 『转』MySQL存储过程语法例子

    原文地址:http://blog.chinaunix.net/uid-540802-id-138873.html ------------------------- 自动生成随机数据存储过程 ---- ...

  10. decorator, async/await, generator

    ////////////decorator////////// function aopFunc (target, key, descriptor) { console.log('aopFunc') ...