_javascript technique of picture layer of JavaScript imitation shutdown effect

Source: Internet
Author: User

First download the JavaScript package:
Http://thecodecentral.com/wp-content/uploads/2007/08/yuilightboxwdep.zip
Modify the following path based on the downloaded JavaScript package
<link rel= "stylesheet" type= "Text/css" href= "Js/yui/assets/skins/sam/container.css"/>
<script type= "Text/javascript" src= "Js/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type= "Text/javascript" src= "Js/yui/dragdrop/dragdrop-min.js" ></script>
<script type= "Text/javascript" src= "Js/yui/container/container-min.js" ></script>
<script type= "Text/javascript" src= "Js/lightbox/lightbox.js" ></script>
<script type= "Text/javascript" ....

Load Lightbox
init = function () ... {
Make a data source containing the original picture
Usage: Picture ID: {URL: "Original picture Path", Title: "Title"}
var DataSource = ... {
Id_1: ... {URL: "image-big.jpg", Title: ' Test Picture '}
};

To create a Lightbox object:
Usage:
Path to ImageBase:Lightbox.js
DataSource: Data source
var lightbox = new YAHOO.com.thecodecentral.Lightbox (..... {
ImageBase: ' Js/lightbox ',
Datasource:datasource
});
}
This line keeps the original.
YAHOO.util.Event.on (window, ' Load ', init);
</script>

<body>
Add a preview picture
Usage:
Note: Keep the picture ID and data source ID consistent

</body>
No annotation for code:
<link rel= "stylesheet" type= "Text/css" href= "Js/yui/assets/skins/sam/container.css"/>
<script type= "Text/javascript" src= "Js/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type= "Text/javascript" src= "Js/yui/dragdrop/dragdrop-min.js" ></script>
<script type= "Text/javascript" src= "Js/yui/container/container-min.js" ></script>
<script type= "Text/javascript" src= "Js/lightbox/lightbox.js" ></script>
<script type= "Text/javascript" >

init = function () {
var DataSource = {
Id_1:{url: "Image-big.jpg", Title: ' Test Picture '}
};

var lightbox = new YAHOO.com.thecodecentral.Lightbox ({
ImageBase: ' Js/lightbox ',
Datasource:datasource
});
}

YAHOO.util.Event.on (window, ' Load ', init);
</script>

<body>

</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.