Here is on the sample page http://jquery.malsup.com/block/ is an example of an overlay message with an image:
$.blockUI({ message: '<h1><img src="busy.gif" /> Just a moment...</h1>' });
But I want to display just an image, so I took out the h1 tag:
$.blockUI({ message: '<img src="busy.gif" />' });
But there is still a background color under my image. How can I remove it?
According with source code of jQuery BlockUI Plugin (v2) it is wrapping the message in an h2 tag
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
so it looks like there is no way without modification of the source code to pass just an image tag.
I might modify the library source code to introduce a new param like image
with a condition:
if (image) $m.append(image);
and than I could declare my image like this:
$.blockUI({ image: '<img src="busy.gif" />' });
Any more ideas?
By default you got that:
// styles for the message when blocking; if you wish to disable
// these and use an external stylesheet then do this in your code:
// $.blockUI.defaults.css = {};
css: {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: '3px solid #aaa',
backgroundColor:'#fff',
cursor: 'wait'
},
So if you don't want any of these just do that in your code:
$.blockUI.defaults.css = {};
Or if you want to exclude background and border just go with that insteard:
$.blockUI.defaults.css = {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
cursor: 'wait'
};
Basically using that external stylesheet you may specify any css style you want.
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