已解决!滚动到这个问题的结尾!div无法正确加载
正如你可以看到here:
我做了一个页面的显示所有的配乐此网站的约,但是当我加载它,不显示创建的行div中的div正确的,直到你悬停其中一个divs,而不是特定的看起来像它必须。我不希望我的访问者必须了解他们如何修复它,这只是令人烦恼,所以应该怎么做。
DOM:
<body>
<div> <!--row wrapper-->
<div class="track"> <!--track information-->
<img src="" /> <!--album cover-->
<h3></h3> <!--artist-->
<p></p> <!--title-->
</div> <!--/track information-->
</div> <!--/row wrapper-->
<div> <!--row wrapper-->
<div class="track"> <!--track information-->
<img src="" /> <!--album cover-->
<h3></h3> <!--artist-->
<p></p> <!--title-->
</div> <!--/track information-->
</div> <!--/row wrapper-->
...
</body>
JS(jQuery的):
$(document).ready(function() {
$('div.track').mouseenter(function() {
$(this).stop(); //stop previous animation
$(this).animate({height:'250'}); //expand, so title and artist will be visible.
});
$('div.track').mouseleave(function() {
$(this).stop(); //stop previous animation
$(this).animate({height:'160px'}); //enlarge the div to it's original size
});
});
CSS:
<style>
.track{
vertical-align:top;
margin-right: 26px;
background-color: #a90000;
padding: 10px;
width: 160px;
height: 160px;
overflow: hidden;
border-radius: 6px;
color: #fff;
cursor: default;
margin-bottom: 20px;
display: inline;
}
</style>
解决!加入
CSS:
.track {
float: left;
}
.row{
clear: left;
}
HTML:
<div class="row">
<div class="track"></div>
<div class="track"></div>
<div class="track"></div>
<div class="track"></div>
<div class="track"></div>
</div>
感谢名单,以hungerstar
添加您CSS还请! – hungerstar
我无法加载您的示例页面 – Huangism
您是否尝试将'float:left'添加到div? – Pieter