开发者

mouseover and resize image of different orientation to div container

开发者 https://www.devze.com 2023-01-03 21:09 出处:网络
When using mouseover a thumbnail of orientation, the image width and height did not fit exactly into \"imax\", a Div element.

When using mouseover a thumbnail of orientation, the image width and height did not fit exactly into "imax", a Div element.

I use the code in HTML Image:

onmouseover='chgImg(this.src)' onmouseout='resImg()'

and Javascript and CSS:

function chgImg(asd) {
    oim = document.getElementById("im").src;
    return document.getElementById("im").src=asd;
}
function resImg() {
    return document.开发者_运维百科getElementById("im").src=oim;
}


#imax {
    width:222px;
    height:222px;
}
#im {
    width:222px;
    height:auto; /* <-- this will overlap which is a problem. */
}
0

精彩评论

暂无评论...
验证码 换一张
取 消