启动 Shadowbox onload——如何让它加载页面?

发布于 2024-11-25 13:51:22 字数 1074 浏览 1 评论 0原文

我已经在链接上使用过 Shadowbox 多次,并且了解 href 会指导 Shadowbox 加载框中的页面,如下所示:

<a rel="shadowbox;width=700;height:500;" id="something" href="/page/iwantto/load/here.php">

但是,我现在需要在用户进入页面时立即显示一个 Shadowbox。不是 onclick,而是 onload。

我正在使用以下代码:

    window.onload = function() {
    // open a welcome message as soon as the window loads
  Shadowbox.open({
      content:    '<div><a href="/some/path/here.php">Clicky</a></div>',
      player:     "html",
      title:      "A Title",
      height:     600,
      width:      700
  });

};

来自 http://www.shadowbox-js.com/usage .html

任何比我更了解 Shadowbox 的人都意识到...这会产生一个带有链接词“clicky”的黑色 Shadowbox,当您单击时,父页面会定向到该链接。

我很抱歉在这里问这样一个基本问题,但我已经用谷歌搜索了几个小时,并阅读了 Shadow-js.com 上的一堆内容,但我没有找到打开 onload Shadowbox 所需的语法链接。我尝试添加这一行:

link:       '/some/path/here.php',

但这也不是。我还阅读了一些有关 .setup 的内容,但不完全理解如何使用它。如果有人能为我指出正确的教程方向或解释一些代码,那就太好了。谢谢。

I've used Shadowbox on a link many times and understand that the href directs Shadowbox as to what page load in the box like this:

<a rel="shadowbox;width=700;height:500;" id="something" href="/page/iwantto/load/here.php">

However, I now need to have a shadowbox appear as soon as users come into the page. Not onclick, but onload.

I am using the following code:

    window.onload = function() {
    // open a welcome message as soon as the window loads
  Shadowbox.open({
      content:    '<div><a href="/some/path/here.php">Clicky</a></div>',
      player:     "html",
      title:      "A Title",
      height:     600,
      width:      700
  });

};

which comes from http://www.shadowbox-js.com/usage.html

As anyone who knows shadowbox better than I do realizes...this results in a black shadowbox with the linked word "clicky" and when you click, the parent page directs to the link.

I apologize for asking such a basic question on here but I've googled for a few hours and read through a bunch of stuff on shadow-js.com and I'm not finding the syntax I need to get the onload shadowbox to open up the link. I've tried adding this line:

link:       '/some/path/here.php',

but that's not it either. I also read a bit about .setup but do not totally understand how to use it. If anyone can point me in the right direction for a tutorial or explain some code that would be great. Thank you.

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

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

发布评论

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

评论(1

温柔戏命师 2024-12-02 13:51:22

内容也错了,标题也没有必要。

window.onload = function() {
  Shadowbox.open({
      content:    'some/path/here.php',
      player:     "iframe",
      height:     600,
      width:      700
  });

};

Content its also wrong, and title its not neccesary.

window.onload = function() {
  Shadowbox.open({
      content:    'some/path/here.php',
      player:     "iframe",
      height:     600,
      width:      700
  });

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