/***********************************
*
*访微博滚动代码(需要引用jquery)
*2011-10-09
************************************/
$(function() {
var scrtime;
$("#div_babyhome").hover(function() {
clearInterval(scrtime);
}, function() {
scrtime = setInterval(function() {
var $ul = $("#div_babyhome ul");
var liHeight = $ul.find("li:last").height();
$ul.animate({ marginTop: liHeight + "px" }, 1000, function() {
$ul.find("li:last").prependTo($ul)
$ul.find("li:first").hide();
$ul.css({ marginTop: 0 });
$ul.find("li:first").fadeIn(1000);
});
}, 3000);
}).trigger("mouseleave");
});
<style type="text/css">
#div_babyhome
{
height: 335px;
position: relative;
background-color: #FFFFFF;
overflow: hidden;
}
#div_babyhome ul
{
position: absolute;
top: 0;
left: 0;
padding: 0;
}
#div_babyhome ul li
{
width: 100%;
overflow: hidden;
}
</style>
<div id="div_babyhome">
<ul id="showItem">
<li></li>
</ul>
</div>