The following are the BlockUI's functionality methods for more control.
Name
Description
Constructor
Constructs a new instance of
KTBlockUIclass and initializes a Dialer control:
var target = document.querySelector("#kt_blockui_target");
var blockUI = new KTBlockUI(target, options);
For the constructor
optionsrefer to the next table.
block()
Block target element
blockUI.block();
release
Release target element
blockUI.release();
isBlocked()
Check if target element is blocked.
if (blockUI.isBlocked() === true) {
// do something
}
destroy()
Removes the component instance from element.
blockUI.destroy();
Static Methods
getInstance(DOMElement element)
Get BlockUI instance created and bind to a target element.
var target = document.querySelector("#kt_blockui_target");
var blockUI = KTBlockUI.getInstance(target);
Constructor Options
All options can be passed to the construction during the plugin initialization:
Name
Type
Default
Description
zIndex
Object
false
Custom CSS z-index value of BlockUI's overlay element.
overlayClass
String
null
Custom CSS class for BlockUI overlay element.
overflow
String
hidden
Forces to set the target element's CSS overflow value to
hiddenif the target element does not have a CSS overflow value. Set the value to
autoto ignore this behaviour.
message
String
<span class="spinner-border text-primary"></span>
Sets BlockUI's HTML content centered within the target element.
Events
Below are few events for hooking into the Bootstrap BlockUI functionality.
Event Type
Description
kt.blockui.block
This event is fired before BlockUI is blocked.
var target = document.querySelector("#kt_blockui_target");
var blockUI = new KTBlockUI(target, options);
blockUI.on("kt.blockui.block", function() {
console.log("before block");
});
kt.blockui.blocked
This event is fired after BlockUI is blocked.
var target = document.querySelector("#kt_blockui_target");
var blockUI = new KTBlockUI(target, options);
blockUI.on("kt.blockui.blocked", function() {
console.log("after blocked");
});
kt.blockui.release
This event is fired before BlockUI release.
var target = document.querySelector("#kt_blockui_target");
var blockUI = new KTBlockUI(target, options);
blockUI.on("kt.blockui.release", function() {
console.log("before release");
});
kt.blockui.released
This event is fired after BlockUI is released.
var target = document.querySelector("#kt_blockui_target");
var blockUI = new KTBlockUI(target, options);
blockUI.on("kt.blockui.released", function() {
console.log("after released");
});