Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear
I have a datalist and i bind the image in datalist. I want to that when i click on image it display on popup with panning and zooming effect by javascript or jquery.

Plz help it's urgent

Thanks
Ram Kumar
Posted

Jquery is the best way to achieve it. Below links have great effects of panning and zooming.

Link 1[^]

Link 2[^]

Link 3[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Feb-12 21:32pm    
Good call samples and sources for the ideas, my 5.
--SA
That's Aragon 9-Feb-12 23:50pm    
Thank you :)
Hi,
Please use follow code behind. Call jscript function while onmouse over or onclick, which is like you.

<pre lang="Javascript">
function EnlargeUserImage(url, imgWidth, imgHeight) {
// debugger
var img = new Image();
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");

img.onload = function () {
imgFull.src = img.src;
imgFull.style.display = "block";
imgFull.style.border = "solid 6px White";
imgFull.style.zIndex = "3000";
};
img.src = url;
var width = screen.width;
var height = screen.height;

if (document.body.clientHeight > document.body.scrollHeight) {
bcgDiv.style.height = document.body.clientHeight + "px";
}
else {
bcgDiv.style.height = document.body.scrollHeight + "px";
}
imgDiv.style.width = imgWidth;
imgDiv.style.height = imgHeight;
//debugger
imgFull.style.width = 0;
imgFull.style.height = 0;

$("document").ready(function () {
$("#imgFull").animate({ height: imgHeight }, "fast");
$("#imgFull").animate({ width: imgWidth }, "fast");
}
);
imgDiv.style.left = (width - imgWidth) / 2 + "px";
imgDiv.style.top = (height - imgHeight) / 6 + "px";
bcgDiv.style.display = "block";
bcgDiv.style.width = "1260px";
bcgDiv.style.height = "730px";
imgDiv.style.display = "block";
return false;
}

function ResizeUserImage() {
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");

if (bcgDiv != null) {
bcgDiv.style.display = "none";
imgDiv.style.display = "none";
imgFull.style.display = "none";
}
}
</pre>

Regards,
anbukrish
 
Share this answer
 
Comments
Ram Kumar(Webunitech) 9-Feb-12 6:29am    
Dear sir all above coding already do. but i want panning and zoom in and zoom out effect on popup image. plz provide any free solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900