復制代碼 代碼如下:
<style type="text/css">
.content{width:500px;height:300px;position:absolute;left:200px;top:100px;border:solid 2px red;padding:10px;overflow:hidden}
dl{width:400px;height:30px;border:1px solid black;}
</style>
<div class="content">
<dl>
<dt>測試數據1</dt>
</dl>
<dl>
<dt>測試數據2</dt>
</dl>
<dl>
<dt>測試數據3</dt>
</dl>
<dl>
<dt>測試數據4</dt>
</dl>
<dl>
<dt>測試數據5</dt>
</dl>
<dl>
<dt>測試數據6</dt>
</dl>
<dl>
<dt>測試數據7</dt>
</dl>
<dl>
<dt>測試數據8</dt>
</dl>
<dl>
<dt>測試數據9</dt>
</dl>
<dl>
<dt>測試數據10</dt>
</dl>
</div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$('.content dl').hide();
$('.content dl:gt('+($('.content dl').length - 5)+')').show();
window.setInterval(function(){
$('.content dl:visible:first').prev().slideDown("fast",function(){
$(this).animate({opacity:1},2000,function(){
if($('.content dl:hidden').length == 0){
$('.content dl').hide();
$('.content dl:gt('+($('.content dl').length - 5)+')').show();
}
});
});
},1000);
});
</script>
代碼演示地址:
http://www.nailyo.com/js_demo/gundong.html