Plug-layer elastic layer

  // need to introduce support before using jquery, links are as follows:
  https://blog-static.cnblogs.com/files/liguanlong/jquery1.9.1.min.js
  // official website plug-in archive Download:
  http://layer.layui.com/mobile/
  // only need to keep layer.js and layer.css can (about 8k), into the corresponding js, css files, page files can be simply introduced layer.js, layer.css file will layer.js file the automatic introduction
  // But we need to manually change my path to create layer.css of layer.js, as shown:
  // read: e + "layer.js find a path from the current to layer.css"
  // configuration is complete, start following api function test -> Reference documents official website: http: //layer.layui.com/mobile/api.html
parameter:
Core interface: the layer.open (options) options:
function popup() {
  layer.open(options)
}
type - The type elastic layer is provided
Type: Number The

Default: 0 (0 indicates block information, layer 1 represents the page, layer 2 represents the loading)

content - content provided elastic layer

Type: String

Required parameters

title - elastic layer provided the title

Type: String or Array

Default: null, value can be a string or array. , Empty is not displayed

title: 'Title'
//or
title: [ 'Title', '#eee;'] // The second parameter can customize the style of the title    
    
time - number of seconds required to automatically close control layer

Type: Number The

Default does not open, integer and floating point support

style - The custom layer

Type: String

Very practical, such as
layer.open({
  style: 'border:none;  color:#fff;',
  Content: 'content' 
})
 
skin - elastic layer display style setting

Type: String

Currently supported configurations footer (ie, bottom of the dialog style), msg (general tips) two styles.

className - a custom class css

Type: String

For custom style. Such as
layer.open({
  className: 'popuo-Login', // so you can control the style of the elastic layer in the inside css 
  content: 'content' 
})
btn - Button

Type: String / Array

Button is not displayed is not provided. If only one button, the btn: 'button', if there are two, then: btn: [ 'a button', 'two buttons'].

anim - type of animation

Type: String / Boolean

Supported support animation configuration: scale (the default), up (from the bottom up pop-up), if you do not open the animation, you can set up false

shade - Control mask show

Type: String / Boolean

Default: true, this parameter allows you to display whether the mask, and the mask defined style

shade: false // do not show the mask
or
shade: 'rgba (0,0,0, .3)' // custom mask transparency    
    
shadeClose

Type: Boolean

Default: off layer is true, whether to click on the mask

fixed - position is fixed layer

Type: Boolean

Default: true

Ordinate control layer - top

Type: Number The

Default: none, generally need not be provided, because the layer is always perpendicular to the middle level, only when fixed: false top when valid.

Callback layer successfully ejected layers - success

Type: Function

This parameter returns a callback parameter of the current layer element objects
success: function(elem){
  console.log(elem);
}   
yes

Type: Function

Point OK button to trigger the callback function returns a parameter for the index of the current layer
yes: function(index){
  Alert ( 'is clicked' )
  layer.close(index)
}    
no

Type: Function

Point cancel button triggers a callback function

end

Type: Function

After the complete destruction of the callback function layer

Built Other methods / properties
layer.v:  Returns the layer mobile version currently used

: layer.close (index)  index is used to close a specific layer, index for the particular layer

layer.closeAll ():  Close all layers layer of the page

Guess you like

Origin www.cnblogs.com/liguanlong/p/12615054.html