我正在使用 jQuery 在悬停图像时对其进行动画处理。我需要它能够使用浏览器重新调整大小/缩放。问题是我无法溢出:隐藏工作,因为我的 div 上没有固定高度。我希望宽度为 100%,我需要高度为 div 宽度的 50%。请帮忙
链接到我的示例 http://www.jasalounge.com/tester/
$(function(){
$("#box1 a").hover(function(){
$("img", this).stop().animate({top:"-50%"},{queue:false,duration:150});
}, function() {
$("img", this).stop().animate({top:"0px"},{queue:false,duration:150});
});
});
#box1 {
width:100%;
max-width:250px;
border:none;
overflow:hidden;
}
#box1 img {
width:100%;
position:relative;
}
<div id="box1"><a href="#"><img src="images/test3.png" alt="test"/></a></div>