【问题标题】:shadowbox opens images onto new pageshadowbox 将图像打开到新页面
【发布时间】:2011-12-08 19:57:04
【问题描述】:

我正在尝试使用 shadowbox.js 在当前网页顶部打开图像。但是,当我单击链接时,它会将我带到我的图像,并且下面的页面会转到空白页面。有谁知道如何在将当前页面保留在下面的同时打开 shadowbox?

这是我的代码:

<head>
    <script src="shadowbox-3.0.3/shadowbox.js" type="text/javascript"></script>
    <link rel="stylesheet" href="shadowbox-3.0.3/shadowbox.css" type="text/css">
</head>

<body onload="Shadowbox.init();">
    <table>
        <tr>
            <td><a href="ss1.jpg" rel="shadowbox[screenshots]">image #1</a></td>
            <td><a href="ss2.jpg" rel="shadowbox[screenshots]">image #1</a></td>
            <td><a href="ss3.jpg" rel="shadowbox[screenshots]">image #1</a></td>
        </tr>
    </table>

</body>

【问题讨论】:

  • 还没有...我还有其他的 javascript(jquery 移动 js 和 css 文件),我也调用它们导致 shadowbox 搞砸了。
  • 你有没有找到问题所在,我使用fancybox和jquery mobile也遇到了同样的问题

标签: javascript html css shadowbox


【解决方案1】:

按照文档建议,将Shadowbox.init() 添加到&lt;head&gt;。可能先放 CSS 链接;正如文档所建议的那样。以下应该进入头部/

<script src="shadowbox-3.0.3/shadowbox.js" type="text/javascript"></script>
<link rel="stylesheet" href="shadowbox-3.0.3/shadowbox.css" type="text/css">
<script type="text/javascript">
 Shadowbox.init();
</script>

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

下面的工作页面:

<html>
<head>
 <script src="shadowbox.js" type="text/javascript"></script>
 <link rel="stylesheet" href="shadowbox.css" type="text/css">
 <script type="text/javascript">
   Shadowbox.init();
 </script>
</head>
<body>
<table>
    <tr>
        <td><a href="ss1.jpg" rel="shadowbox[screenshots]">image #1</a></td>
        <td><a href="ss2.jpg" rel="shadowbox[screenshots]">image #2</a></td>
        <td><a href="ss3.jpg" rel="shadowbox[screenshots]">image #3</a></td>
    </tr>
</table>
</body>
</html>

【讨论】:

  • 刚刚尝试过,它仍然在背景为空白的页面上打开它。还有其他建议吗?
  • 运气不好。我将shadowbox文件夹中的所有文件和图像复制到我的根文件夹中,它仍然无法正常工作
  • 显示图像的代码部分与 urs 完全一样(减去图像名称)... safari 和 firebox 都在空白页上显示图像,但当我尝试运行时它在即它一直告诉我在第 17064 行的 shadowbox.js 文件中存在和错误
  • internet explorer 说 theres an invalid argument... 当我进入 shadowbox.js 中的行时,它有:{aS.style[aQ]=""+aT+"px"}
猜你喜欢
  • 2023-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-24
  • 1970-01-01
  • 1970-01-01
  • 2011-08-06
  • 1970-01-01
相关资源
最近更新 更多