gpt4 book ai didi

javascript - Shadowbox(js)作为弹出窗口

转载 作者:行者123 更新时间:2023-11-30 18:34:37 26 4
gpt4 key购买 nike

我正在玩 shadowbox,我想在用户登陆我网站的索引页面时启动它。

我可以像那样使用阴影框:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>title</title>

<!-- Set paramètres pour le shadowbox (CSS, JS? . . .) -->
<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init();
</script>
</head>
<body>
<a href="image.png" rel="shadowbox" title="scronieunieu">My Image</a>
</body>
</html>

我尝试制作一个onload函数但是它不起作用(我不能在上面设置图片链接?):

<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {onPageLoad()});

window.onload = function(){
Shadowbox.init();
};
</script>
</head>

最佳答案

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clemz</title>

<!-- Set paramètres pour le shadowbox (CSS, JS? . . .) -->
<link rel="stylesheet" type="text/css" href="shadowbox/shadowbox.css">
<script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
// skip the automatic setup
skipSetup: true
});

window.onload = function() {
// open ASA the window loads
Shadowbox.open({
content: '<img src="image.png" alt="alt" />',
player: "html",
title: "Welcome dude",
height: 502,
width: 350
});
};
</script>
</head>

<body>
<h1>Hello World</h1>
</body>
</html>

正常工作 ;-)

关于javascript - Shadowbox(js)作为弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8608229/

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