开发者

ASP.net and javascript automatically open lightbox

开发者 https://www.devze.com 2023-03-13 04:46 出处:网络
Im trying to add a light box which automatically op开发者_运维百科ens up when someone visits my homepage. something similar to

Im trying to add a light box which automatically op开发者_运维百科ens up when someone visits my homepage. something similar to

http://directorsof.com/

any idea on how I can do this.


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.


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.

http://www.snippetbank.net/detail/snippetdetail/9-aspcsharp/3-filemanipulation/404-Web-MessageBox.html


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消