modal.js
A modern and simple modal
NPM
npm install --save modal.js
Download
See https://necolas.github.io/normalize.css/latest/normalize.css
What does it do?
- Build a modal customizable.
- By default create text, image modal.
- You can customize it with parameters
- Its possible to create different styles of the same modal and then choose one
Browser support (Only tested on)
- Chrome (last two)
- Firefox (last two)
Modal on!
Default mode
Not recommended! My use of styles is disgusting, You are warned!
$().modal({"content": {"type":"text","data": "Hola mundo!" }});
$().modal({"content": {"type":"image", "data": "http://lorempixel.com/400/200/"}})
Newbie mode
The parameter is json with this structure:
'content' : {
'type' : String,
'data' : Object,
'className' : String,
},
'shape' : {
'className' : String,
'style' : String
}
'layout' : String,
'header' : {
'icon' : String,
'title' : {
'className' : String,
'content' : String
}
},
'close' : {
'button' : Boolean,
'escape' : Boolean
},
'acc' : {
'text' : String
},
'btns' : [{
'value' : String,
'shape' : String,
'type' : String,
'action' : String,
'close' : Boolean,
'key' : CharCode
}],
'overlay' : {
'className' : String,
'click' : Boolean
},
'width' : String
Pro mode
You can modify defaults plugins.json and create diferents templates of modal. Plugins.json have this structure:
"text" : {
"element" : "",
"objAttrs": {
"innerHTML" : "",
"id" : ""
},
'attrs' : {
},
"dfts" : {
"shape" : "",
"shapeStyle" : "",
"layout" : "",
"icon" : "",
"mb_clase" : ""
}
}
Use text plugin for guide you.
God mode
By default, Chrome on OS X and Safari on OS X allow very limited styling of
select
, unless a border property is set. The default font weight on optgroup
elements cannot safely be changed in Chrome on OSX and Safari on OS X.
Acknowledgements
Normalize.css is a project by Nicolas Gallagher,
co-created with Jonathan Neal.