Here is one version in which you can drag and drop the original image as well as the popped up image to the location you wish.
I've used the following items together for this purpose:
http://www.dynamicdrive.com/dynamici...drag/index.htm - For the drag and dropping purpose.
http://www.dynamicdrive.com/style/cs...-image-viewer/ - Image popup viewer
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
.thumbnail {
position: relative;
z-index: 0;
}
.thumbnail:hover {
background-color: transparent;
z-index: 50;
}
.thumbnail span { /*CSS for enlarged image*/
position: absolute;
background-color: lightyellow;
padding: 5px;
left: -1000px;
top: 0;
border: 1px dashed gray;
visibility: hidden;
color: black;
text-decoration: none;
}
.thumbnail span img { /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
}
.thumbnail:hover span { /*CSS for enlarged image on hover*/
visibility: visible;
top: 0;
left: 60px; /*position where enlarged image should offset horizontally */
}
</style>
<!--[if IE]>
<style type="text/css">
.thumbnail span { /*CSS for enlarged image*/
position: absolute;
background-color: lightyellow;
padding: 5px;
left: -1000px;
top: 0;
border: 1px dashed gray;
visibility: hidden;
color: black;
text-decoration: none;
margin-top: 55px;
}
</style>
<![endif]-->
<script type="text/javascript" src="dom-drag.js"></script>
</head>
<body>
<a class="thumbnail" href="#thumb" id="tree1"><img src="tree_thumb.jpg" width="100px" height="66px" border="0" /><span id="tree2" style="position:absolute;"><img src="tree.jpg" />
<br/>
Simply beautiful.
</span>
</a>
<a class="thumbnail" href="#thumb" id="ocean1"><img src="ocean_thumb.jpg" width="100px" height="66px" border="0" /><span id="ocean2" style="position:absolute;"><img src="ocean.jpg" />
<br/>
So real, it's unreal. Or is it?
</span>
</a>
<br/>
<br/>
<script type="text/javascript">
//Enabling draging and dropping on the small (original images)
Drag.init(document.getElementById("ocean1"));
Drag.init(document.getElementById("tree1"));
//Enabling draging and dropping on the popped up images
Drag.init(document.getElementById("ocean2"));
Drag.init(document.getElementById("tree2"));
</script>
</body>
</html>
I've highlighted all the important part in which I've made changes while integrating two different things together. I've also inserted an IE specific CSS section as IE used to show the popped up image covering the original image unlike the way FF used to show.
I've used my own image names and IDs which in your case can be changed according to your requirement.
Please find an attachment containing the HTML page, images, JS files, etc. Just unzip it and store together and open the HTML page in your browser and try to hover your mouse over the image and drag the popped up image or the original image.
If you wish to disable the dragging and drop of original images then comment the following section in the code:
Code:
//Enabling draging and dropping on the small (original images)
Drag.init(document.getElementById("ocean1"));
Drag.init(document.getElementById("tree1"));
If you wish to disable the dragging and drop of popped up images then comment the following section in the code:
Code:
//Enabling draging and dropping on the popped up images
Drag.init(document.getElementById("ocean2"));
Drag.init(document.getElementById("tree2"));
Let me know if there is anything you need to fix in this case.
Bookmarks