View Single Post
Old 06-28-2012, 03:15 AM   PM User | #1
coidn
New to the CF scene

 
Join Date: Jun 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
coidn is an unknown quantity at this point
Image expand/zoom script problem

Hello dear codingforums members...
This is my first post,

I have this script which is used to expand/zoom an image to make it look larger..
But it only works in IE but not in Firefox or Google Chrome... Can anyone have a look and help out...

I came to know that img.style.width=obj.width*2; is not supported in chrome and fire...

So if there is some alterations I could make to the code...

Code:
function Large(obj)
{
  debugger;
 
    var imgbox=document.getElementById("imgbox");
    imgbox.style.visibility='visible';
    var img = document.createElement("img");
    var statusbar = document.createElement("span");
    var Urlstr=obj.alt;
    img.src=obj.src;//replace("_th.jpg","_pr.jpg");
    img.style.width=obj.width*2;
    img.style.height=obj.height*2;
   

  document.getElementById('<%=hdnInfoUrl.ClientID%>').value=Urlstr;
  
    if(img.addEventListener){
        img.addEventListener('mouseout',Out,false);
        
    } else {
        img.attachEvent('onmouseout',Out);
       img.attachEvent('onclick',ClickThis);
    }             
    imgbox.innerHTML='';
    imgbox.appendChild(img);
    imgbox.style.left=(getElementLeft(obj)-50) +'px';
    imgbox.style.top=(getElementTop(obj)-50) + 'px';
    // add span
    statusbar.innerHTML = "<p>Other Image Details Text</p>";
    imgbox.appendChild(statusbar);
}
function Out()
{
document.getElementById("imgbox").style.visibility='hidden';
}



So there is a hidden div with id=imgbox on the html page, when mouse is hovered on a thumbnail,this div gets visible and the image is increased in width and height and displayed...when on mouse out its invisible... works in IE ....
coidn is offline   Reply With Quote