I used the following which works correctly but I need to have a close button rather than closing automatically how to do that? (I am using jQuery BlockUI http://www.malsup.com/jquery/block/#demos)
$(document).ready(function() {
$('#app').click(function() {
$.blockUI({
theme: true,
title: 'Welcome to your page',
message: '<p>Please have a look..</p>',
timeout: 2000
});
});
});
I don't know if you are still interested in this, but I was looking for it and could not find it, so I had to create my own solution. You have to update the plugin though (jquery.blockUI.js), and go to this line:
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>';
and replace it with this one:
if ( opts.title ) {
s += '<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span id="ui-id-1" class="ui-dialog-title">' +(opts.title || ' ')+ '</span><button id="btnCloseBlockUI" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close" role="button" aria-disabled="false" title="close"><span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">close</span></button></div>';
This will add a button to the title bar. To add a button click handler:
//Unblocks the UI when clicking the close button
$("button#btnCloseBlockUI.ui-button").click(function () {
$.unblockUI();
});
You can be more fancy and add an extra option, something like showCloseButtonUI
and display it only when it's set to true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With