Click here to Skip to main content
14,690,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to resize images dynamicalyy that images which are placed in table in my table all rows containing images only it genarate dyanamicalyy
Posted

1 solution

You can solve this easily with javascript.
What is your problem exactly?
   
Comments
kingsa 16-May-12 7:11am
   
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
p {
font-family:Verdana;
font-weight:bold;
font-size:11px
}

img {
cursor:pointer;
}
</style>
<script type="text/javascript" language="ecmascript">
function SBImage(obj) {
document.getElementById("previewDiv").innerHTML = "<img src='" + obj.src + "'+'width=500 height=500' >";
}
function SDImage(obj) {
document.getElementById("previewDiv").innerHTML = "";
}
// function move_Area(event) {
// event = event || window.event;
// previewDiv.style.left = event.clientX + document.body.scrollLeft + 10;
// previewDiv.style.top = event.clientY + document.body.scrollTop + 10;
// }
// // document.onmousemove = move_Area;
</script>


</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" runat="server" Width="100px" Height="100px"
ImageUrl="~/1194985741181349746770a002.svg.med.png"
onmouseover="SBImage(this);"
onmouseout="SDImage(this);"/>
<asp:Image ID="Image2" runat="server" Width="100px" Height="100px"
ImageUrl="~/images/2059731553.png"
onmouseover="SBImage(this);"
onmouseout="SDImage(this);"/>
</div>
<div id="previewDiv" style="position: absolute; z-index:2">
</div>
</form>
</body>
</html>
kingsa 16-May-12 7:12am
   
I Had done dis but its limted images i want dynamicalyy which i having in dynamic genarated table
Zoltán Zörgő 16-May-12 7:34am
   
Use a specific class name, that you add to your IMG tag when you generate it. Use JQuery to add on page loaded your current onmouseover and onmouseout event handlers to the images with that specific class name.

$(function() {
$("IMG.hoverimgclass").mouseover(function() {
$("#previewDiv").html("<img src='" + $(this).attr("src") + "'+'width=500 height=500' >");
})
});

Well, the inner part can be made more jquery, but the idea is this.
I suggest dont change the innerhtml of the div, place an image, and change its src and visibility.
Zoltán Zörgő 17-May-12 2:47am
   
Update: I am not sure what you mean by "dynamic": is it serverside generated or client side. With serverside you can use what I posed. If your images are generated on client side with JS, you have to add the event handlers during or after element generation, since on pageload they will exist yet.

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