1 <script type="text/javascript"> 2 3 var t = setInterval('AutoScroll(".isBIM_single_news")', 2000); 4 5 $(document).ready(function () 6 { 7 8 $("#isBIM_news_content").mouseenter(function () 9 {10 clearInterval(t);11 })12 13 $("#isBIM_news_content").mouseleave(function ()14 {15 t= setInterval('AutoScroll(".isBIM_single_news")', 2000);16 })17 18 });19 20 function AutoScroll(obj)21 {22 $(obj).find("ul:first").animate({ marginTop: "-170px" }, 1200, function ()23 {24 $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);25 });26 }27 </script>
.mouseover() //经过子元素也会触发.mouseenter() //经过被选元素才会触发.mouseout() //离开子元素也会触发.mouseleave() //离开被选元素才会触发
.Hide() //隐藏.Show() //显示.FadeIn() //淡入.FadeOut() //淡出
自己做网站正好用到,所有消息是放在一个Div层里的ul中,每条消息是放在ul的li中。li中可根据自己需求加入一些<a>,<image>,<div>。可作为前端测试使用。
原标题:JQuery新闻滚动的实现方法(常用笔记1)
关键词:jquery