繼續關閉this question,我試圖在調整窗口大小的同時模擬同一個動畫。製作一個「動態」div響應
到目前爲止,我已將「.img-responsive」類(在bootstrap.css中找到)添加到圖像中,但不幸的是,div的尺寸不會相應地進行調整。
我該怎麼辦?
HTML:
<img class="img-responsive" src='http://www.videsignz.com/testing/images/water-front2.png' />
<div></div>
JS:
function animateit(){
$('div').animate({'height' : '350px', 'top' : 0 }, 2000, function() {
$('div').animate({'height' : 0, 'top' : '350px' }, 2000, animateit);
});
}
animateit();
CSS:
.img-responsive {
display: block;
width: 100% \9;
max-width: 100%;
height: auto;
}
img {
position:absolute;
left:0px;
top:0px;
z-index:5;
}
div {
position:absolute;
left:0px;
top:350px;
background-color:#67d9ff;
height:0px;
display:block;
width:350px;
}
什麼是'.IMG-responsive'的CSS? – jmore009
我的壞,忘了提及我使用Bootstrap。 – michael