| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- /*=========================================================================================
- File Name: block-ui.js
- Description: Block UI jQuery Plugin Intialization
- --------------------------------------------------------------------------------------
- Item Name: Robust - Responsive Admin Theme
- Version: 1.2
- Author: PIXINVENT
- Author URL: http://www.themeforest.net/user/pixinvent
- ==========================================================================================*/
- $(document).ready(function(){
- /************************************
- * Block Examples *
- ************************************/
- $('.block-element').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Block sidebar
- $('.block-sidebar').on('click', function() {
- var block_ele = $('.main-menu');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#FFF',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Block page
- $('.block-page').on('click', function() {
- $.blockUI({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#FFF',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- /************************************
- * Message Options *
- ************************************/
- // Spinner only
- $('.block-spinner-only').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Defult Message
- $('.block-default-message').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<span class="semibold"> Loading...</span>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Message Animation
- $('.block-msg-animation').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="semibold"><span class="icon-spinner9 icon-spin text-left"></span> Loading ...</div>',
- fadeIn: 1000,
- fadeOut: 1000,
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: '10px 15px',
- color: '#fff',
- width: 'auto',
- backgroundColor: '#333'
- }
- });
- });
- // Multiple messages
- $('.block-multiple-msgs').on('click', function() {
- var message = $('.multiple-msgs');
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: message,
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- // width: 200,
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- },
- onBlock: function(){
- clearTimeout();
- }
- });
- window.setTimeout(function () {
- message.html('<div class="semibold"><span class="icon-spinner9 icon-spin text-left"></span> Loading ...</div>');
- }, 0);
- window.setTimeout(function () {
- message.html('<div class="semibold">Just a minute...</div>');
- }, 2000);
- window.setTimeout(function () {
- message.addClass('bg-success').html('<div class="semibold"><span class="icon-thumbs-o-up text-left"></span> Success</div>');
- }, 4000);
- window.setTimeout(function () {
- $(block_ele).unblock({
- onUnblock: function(){
- message.removeClass('bg-success');
- }
- });
- }, 6000);
- });
- // Non centered message
- $('.block-non-centered-msg').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="semibold"><span class="icon-spinner9 icon-spin text-left"></span> Loading ...</div>',
- timeout: 2000, //unblock after 2 seconds
- centerX: 0,
- centerY: 0,
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- top: '10px',
- left: '',
- right: '10px',
- border: 0,
- padding: '10px 15px',
- backgroundColor: 'transparent'
- }
- });
- });
- /****************************************
- * Overlay Examples *
- ****************************************/
- // Light overlay
- $('.block-light-overlay').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Custom overlay
- $('.block-opaque-overlay').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#2962FF',
- opacity: 1,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- color: '#fff',
- backgroundColor: 'transparent'
- }
- });
- });
- // Overlay with custom color
- $('.block-custom-overlay').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#E91E63',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- color: '#fff',
- backgroundColor: 'transparent'
- }
- });
- });
- /****************************************
- * Callback Options *
- ****************************************/
- // onBlock callback
- $('.onblock-callback').on('click', function() {
- $.blockUI({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- fadeIn: 1000,
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#FFF',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- color: '#333',
- backgroundColor: 'transparent'
- },
- onBlock: function() {
- alert('Page is now blocked, FadeIn complete.');
- }
- });
- });
- // onUnblock callback
- $('.onunblock-callback').on('click', function() {
- $.blockUI({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#FFF',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- color: '#333',
- backgroundColor: 'transparent'
- },
- onUnblock: function() {
- alert('Page is now unblocked. FadeOut complete.');
- }
- });
- });
- // Overlay callback
- $('.onoverlay-click-callback').on('click', function() {
- $.blockUI({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- overlayCSS: {
- backgroundColor: '#FFF',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- color: '#333',
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- },
- onOverlayClick: $.unblockUI
- });
- });
- /************************************
- * Other Options *
- ************************************/
- // Block Without Message
- $('.block-without-msg').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: null,
- timeout: 2000, //unblock after 2 seconds
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- });
- // Block without overlay
- $('.block-without-overlay').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- showOverlay: false,
- timeout: 2000, //unblock after 2 seconds
- css: {
- width: 50,
- height: 50,
- lineHeight: 1,
- color: '#FFF',
- border: 0,
- padding: 15,
- backgroundColor: '#333'
- }
- });
- });
- // Unblock on overlay click
- $('.overlay-unblock').on('click', function() {
- var block_ele = $(this).closest('.card');
- $(block_ele).block({
- message: '<div class="icon-spinner9 icon-spin icon-lg"></div>',
- overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.8,
- cursor: 'wait'
- },
- css: {
- border: 0,
- padding: 0,
- backgroundColor: 'transparent'
- }
- });
- $('.blockOverlay').on('click', function() {
- $(block_ele).unblock();
- });
- });
- // Growl notification
- $('.growl-notification').on('click', function() {
- $.blockUI({
- message: $('.growl-notification-example'),
- fadeIn: 700,
- fadeOut: 700,
- timeout: 50000,
- showOverlay: false,
- centerY: false,
- css: {
- width: '250px',
- top: '20px',
- left: '',
- right: '20px',
- border: 'none',
- padding: '15px 5px',
- backgroundColor: '#333',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px',
- opacity: 0.9,
- color: '#fff'
- }
- });
- });
- });
|