ASP.net和javascript自动打开灯箱

发布于 2024-11-15 11:39:35 字数 151 浏览 1 评论 0原文

我正在尝试添加一个灯箱,当有人访问我的主页时,该灯箱会自动打开。类似于

http://directorsof.com/

关于如何做到这一点的任何想法。

Im trying to add a light box which automatically opens up when someone visits my homepage. something similar to

http://directorsof.com/

any idea on how I can do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

望喜 2024-11-22 11:39:35

例如,您可以使用 colorbox 来获取在页面加载后打开的灯箱。
从这里下载colorbox:http://colorpowered.com/colorbox/latest,解压文件并修改example1 文件夹中的index.html 文件。

替换:

$("a[rel='example1']").colorbox();

$("a[rel='example1']").colorbox({open:true});

在浏览器中打开index.html 文件即可直接看到灯箱。

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.

人间☆小暴躁 2024-11-22 11:39:35

您使用母版页吗?您需要在文件中放置 2 个 div。一个具有固定位置或绝对位置并使背景变暗,另一个 div 显示内容。

查看此链接,它是一个网络消息框,但它将使用模板方法执行您想要的操作。

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

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

清欢 2024-11-22 11:39:35

您可以将以下内容添加到您的主页,

window.onload = function() {
     //Open your lightbox here
};

或者您可以将 Jquery 与类似的东西一起使用...

$(function(){
   $(body).load(function(){
      // Open your lightbox here
   });
});

一旦页面加载,以上两者都会触发灯箱。使用 jquery 示例可能更好,因为这将确保 DOM 已准备就绪。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文