本文介绍了shadowbox(js)作为弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm playing with shadowbox and I wanna launch it when user's landing on the index page of my website.

我可以像这样使用shadowbox:

I can use the shadowbox like that :

<!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函数但它不起作用(我无法设置链接到它上面的图片?):

I tried to make a onload function but it doesn't working (I can't set the link to the picture on it?) :

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

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

感谢帮助我,我在JS上非常糟糕......

Thanks to help me, I'm very bad on JS ...

推荐答案

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

确实有效; - )

这篇关于shadowbox(js)作为弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 02:51