jquery code:
<script language="javascript">
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
$(document).ready(function()
{
//播放速度
var speed = 2000;
//控制范围
var block = '#indexLinks li';
//需要显示的内容条目数
var eq = 8;
var h = 0;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if($(block).length > eq)
{//如果内容数目大于需要滚动的数目,开始滚动
//隐藏除了第一个的其它所有节点
$(block).slice(eq).css('display','none');
//播放开始
h = setInterval('scrollContent("'+block+'",'+eq+',2)',speed); // 多少秒后执行一次函数。附值情况下也会被执行代码
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
$('#siteBulletin').mouseout(function()
{
h = setInterval('scrollContent("'+block+'",'+eq+',2)',speed);
});
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
$('#siteBulletin').mouseover(function()
{
clearInterval(h);
});
}
});
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function scrollContent(block,eq,type)
{
//获取第节点
var firstNode = $(block);
//动画效果
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
switch(type)
{
case 1:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_out =
{height:'hide'};
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_in =
{height:'show'};
break;
case 2:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_out =
{opacity:'hide'};
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_in =
{opacity:'show'};
break;
case 3:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_out =
{height:'hide',opacity:'hide'};
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
animation_in =
{height:'show',opacity:'show'};
break;
default:'';
}
//开始动画
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
firstNode.eq(0).animate(animation_out,1000,function()
{//Òþ²Ø
//克隆。追加到最后。隐藏
$(this).clone().appendTo($(this).parent()).css('display','none');
//显示第二个节点内容
firstNode.eq(eq).removeAttr('style').animate(animation_in,1000);
//删除第一个节点内容
$(this).remove();
});
}
</script>
posted @
2009-03-24 14:29
朝夕
阅读(
2276)
评论()
编辑
收藏
举报