gpt4 book ai didi

javascript - shadowbox 在新页面上打开图像

转载 作者:太空宇宙 更新时间:2023-11-03 19:10:41 25 4
gpt4 key购买 nike

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

这是我的代码:

<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>

最佳答案

添加 Shadowbox.init()<head>正如文档所建议的那样。可能把 CSS 链接放在第一位;再次如文档所示。下面应该进入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">
<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>

关于javascript - shadowbox 在新页面上打开图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8436838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com