modal-1k
Super tiny jquery plugin for modal windows. JS size 1163 bytes minified, 643 bytes gziped.
Main Ideas
- No images, iframes, etc. Only html content
- Real modal window (no scrolling!)
- CSS should be outside code
- No build-in ajax functionality, but easy to use with ajax
- No animation (it's just a popups, not a fkng circus)
- ~1kb of gziped JS+CSS are enough for modal window plugin
- No automate binding. It's may be done by 1 line of code if needed
- There may be more than one modal window. Supports nested windows.
- Supports any browsers whitch jquery (1.7+) supports
Examples
Simple default way:
Open popup Window contents
;
Or you can bind to any links with data attribute:
;
so you can do this:
Open popup
Or you can load any content:
;
It's usefull for ajax:
$
Options
List of options with default values:
{
id : 'm1k', // It's a namespace. Append to every css class name
single: false, // Close other modal windows when open new window
esc: true, // Close window on esc
click: true, // Close window on click in back
close: 'x' // Close button contents. Can be null|undefined
}
There 3 ways to pass options:
- defaults:
$.m1k.default
- direct:
m1k({options})
- data attributes:
<div class='popup' data-esc='false'>
API
$.m1k.close()
— close current window