Block/Unblock
An effective and practical screen blocker for jQuery with delay, timeout and an easy API.
Download
Download from GitHub: https://github.com/vanderlee/block-unblock
MIT licensed
Features
- Delay; block immediately, but start the visualization after a short delay.
- Timeout; unblock after a timeout period and call an event.
- Optional content.
- Styling either inline or using a classname or id.
- Configurable fade-in speed.
- Very simple API ($.block() and $.unblock()).
Example
- delay visualization 1 second
- timeout after 3 seconds (including delay)
Options
- context: The context in which the blocking is used. Default 'body'.
- css: A classname to assign to the overlay visualization.
- delay: Wait this many milliseconds before showing visualization. (note that blocking functionality is always immediate). Default 500 (half a second).
- id: An ID to assign the the overlay visualization.
- message: HTML content to display in the center of the overlay.
- speed: The speed with which to fade in the visualization. Default 'slow'.
- style: Style of the overlay. Default 50% transparent black.
- timeout: Time before timeout event is triggered and blocking automatically unblocked. Default 10000 (10 seconds).
- zIndex: z-index of the overlay. Must be greater than any window it's supposed to block. Default 20000.
Events
- onblock: Triggered when blocking starts.
- onunblock: Triggered when blocking ends (not on timeout).
- ontimeout: Triggered if a timeout occurs.
- ondisplay: Triggered after the delay has passed and visualization starts.