鼠标悬停并调整不同方向的图像到div容器

时间:2010-06-19 19:53:42

标签: javascript css

当使用鼠标悬停方向缩略图时,图像宽度和高度不完全适合“imax”,即Div元素。

我使用HTML Image中的代码:

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

和Javascript和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 个答案:

没有答案