当使用鼠标悬停方向缩略图时,图像宽度和高度不完全适合“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. */
}