首先下载JavaScript包:
http://thecodecentral.com/wp-content/uploads/2007/08/yuilightboxwdep.zip
<html>
<head>
//根据下载的JavaScript包修改以下的路径
<link rel="stylesheet" type="text/css" href="js/yui/assets/skins/sam/container.css" />
<script type="text/javascript" src="/UploadFiles/2021-04-02/yahoo-dom-event.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/dragdrop-min.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/container-min.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/Lightbox.js"><script type="text/javascript">...
//加载 lightbox
init = function()...{
//制作一个数据源,含原本图片
//用法: 图片ID: {url: "原本图片路径", title:"标题" }
var dataSource = ...{
id_1:...{url:"image-big.jpg", title: '测试图片'}
};
//创建 Lightbox 对象:
//用法:
//imageBase: Lightbox.js 的路径
//dataSource: 数据源
var lightbox = new YAHOO.com.thecodecentral.Lightbox(...{
imageBase:'js/lightbox',
dataSource: dataSource
});
}
//这行保持原貌
YAHOO.util.Event.on(window, 'load', init);
</script>
</head>
<body>
//加一个预览图片
//用法:<img src="/UploadFiles/2021-04-02/预览.jpg">//注意:保持图片ID和数据源ID一致
<img src="/UploadFiles/2021-04-02/image-small.jpg"></body>
</html>
代码无注解:
<html>
<head>
<link rel="stylesheet" type="text/css" href="js/yui/assets/skins/sam/container.css" />
<script type="text/javascript" src="/UploadFiles/2021-04-02/yahoo-dom-event.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/dragdrop-min.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/container-min.js"><script type="text/javascript" src="/UploadFiles/2021-04-02/Lightbox.js"><script type="text/javascript">
init = function(){
var dataSource = {
id_1:{url:"image-big.jpg", title: '测试图片'}
};
var lightbox = new YAHOO.com.thecodecentral.Lightbox({
imageBase:'js/lightbox',
dataSource: dataSource
});
}
YAHOO.util.Event.on(window, 'load', init);
</script>
</head>
<body>
<img src="/UploadFiles/2021-04-02/image-small.jpg"></body>
</html>
JavaScript,关机
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com