Reputation: 4334
Im trying to add a light box which automatically opens up when someone visits my homepage. something similar to
any idea on how I can do this.
Upvotes: 0
Views: 1698
Reputation: 2830
You can add the following to your home page
window.onload = function() {
//Open your lightbox here
};
Or you can use Jquery all together with something like...
$(function(){
$(body).load(function(){
// Open your lightbox here
});
});
both of the above will fire the lightbox once the page is loaded. Its probably better to use the jquery example as this will ensure that the DOM is ready.
Upvotes: 0
Reputation: 88
You can use for example colorbox to get a lightbox that opens after the page is loaded. Download colorbox from here: http://colorpowered.com/colorbox/latest, extract the file and modify the index.html file in the example1 folder.
Replace:
$("a[rel='example1']").colorbox();
with
$("a[rel='example1']").colorbox({open:true});
Open the index.html file in your browser to see the lightbox coming up directly.
Upvotes: 1
Reputation: 760
are you using a master page?You need to place 2 divs in your file. One that has a fixed position or absolute and dimmer the background, and another div that displays the content.
Check this link out, it is a web messagebox but it will do what you want using a template approach.
Upvotes: 1