百转千回,万物皆变心不动,任清风自流。

html,css,jQuery,javascript,php,mysql,dedecms,phpcms,wordpress,linux,windows
  首页  :: 订阅 订阅  :: 管理

jQuery滚动图片特效,jQuery无缝(不连续)滚动图片代码

Posted on 2012-06-23 09:33  李潇喃  阅读(191)  评论(0)    收藏  举报
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>不连续滑动</title> <meta name="author" content="ximan" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <style type="text/css"> *{margin:0;padding:0;} img{border:none;} #slide{overflow:hidden;width:900px;margin:100px auto;} ul{list-style:none;width:2999px;} li{float:left;} </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> function AutoScroll(){ var _scroll = $("#slide>ul"); //ul往左边移动300px _scroll.animate({marginLeft:"-300px"},1000,function(){ //把第一个li丢最后面去 _scroll.css({marginLeft:0}).find("li:first").appendTo(_scroll); }); } $(function(){ //两秒后调用 var _scrolling=setInterval("AutoScroll()",2000); $("#slide>ul").hover(function(){ //鼠标移动DIV上停止 clearInterval(_scrolling); },function(){ //离开继续调用 _scrolling=setInterval("AutoScroll()",2000); }); }); </script> </head> <body> <h1><a href="http://ons.me/" target="_blank" title="一个热爱网络的年轻人的博客">西门的后花园</a></h1> <h2><a href="http://ons.me/299.html" target="_blank">jQuery滚动图片特效,jQuery无缝滚动图片代码</a></h2> <div id="slide"> <ul> <li><img src="1.jpg" /></li> <li><img src="2.jpg" /></li> <li><img src="3.jpg" /></li> <li><img src="4.jpg" /></li> <li><img src="5.jpg" /></li> </ul> </div> </body> </html>   摘自  http://ons.me/299.html