jQuery的一个不错的小插件,jquery.imageScroller.js代码:
  • <!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>
  •     <title>jQuery无缝滚动</title>
  •     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  •     <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
  •     <script type="text/javascript" src="http://img.rbtvs.com/js/jquery.imageScroller.js"></script>
  •     <style type="text/css">
  •         *
  •         {
  •             list-style: none;
  •             font-size: 12px;
  •             padding: 0;
  •             margin: 0;
  •         }
  •         
  •         #list li
  •         {
  •             width: 90px;
  •             height: 18px;
  •             line-height: 18px;
  •             text-align: center;
  •             padding: 41px 0;
  •             float: left;
  •             margin: 0 5px;
  •             background-color: Aqua;
  •         }
  •         
  •         #btnPrev, #btnNext, #listBox
  •         {
  •             float: left;
  •         }
  •         
  •         #btnPrev, #btnNext
  •         {
  •             width: 30px;
  •             height: 18px;
  •             line-height: 18px;
  •             padding: 41px 0;
  •             background: #ff9;
  •             text-align: center;
  •         }
  •         
  •         #listBox
  •         {
  •             width: 400px;
  •             height: 100px;
  •             overflow: hidden;
  •             background: #000;
  •         }
  •         
  •         #container
  •         {
  •             width: 460px;
  •             height: 100px;
  •             background: red;
  •             position: absolute;
  •             left: 50%;
  •             top: 50%;
  •             margin-left: -230px;
  •             margin-top: -50px;
  •         }
  •     </style>
  •     <script type="text/javascript">

  •         $(function () {
  •             $("#listBox").imageScroller({
  •                 next: "btnNext",
  •                 prev: "btnPrev",
  •                 frame: "list",
  •                 child: "li",
  •                 auto: true
  •             });
  •         });
  •     </script>
  • </head>
  • <body>
  •     <div >
  •         <div >
  •             <<
  •         </div>
  •         <div >
  •             <ul >
  •                 <li>001</li>
  •                 <li>002</li>
  •                 <li>003</li>
  •                 <li>004</li>
  •                 <li>005</li>
  •                 <li>006</li>
  •                 <li>007</li>
  •                 <li>008</li>
  •                 <li>009</li>
  •             </ul>
  •         </div>
  •         <div >
  •             >>
  •         </div>
  •     </div>
  • </body>
  • </html>
  • 复制代码
    在线演示:

    如果您不想当成插件来用,里面的代码也可以单独扒出来(麦考林首页就是这么用的)

    相关文章:

    • 2021-09-13
    • 2018-08-23
    • 2021-11-17
    • 2021-11-08
    • 2021-11-01
    • 2018-05-03
    • 2021-10-31
    • 2018-09-23
    猜你喜欢
    • 2021-11-17
    • 2021-11-24
    • 2021-11-12
    • 2021-10-04
    • 2021-12-10
    • 2021-10-06
    • 2021-10-07
    相关资源
    相似解决方案