参照: liScroll (a jQuery News Ticker made easy) 1.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" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <link rel="stylesheet" type="text/css" href="/content/lib/jquery/jScrollPane.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="/content/lib/jquery/jquery.li-scroller.1.0.js"></script> <script type="text/javascript"> $(function() { /* デフォルト */ $("ul#ticker01").liScroll(); /* スクロール速度を指定 */ $("ul#ticker02").liScroll({travelocity:0.08}); }); </script> <style type="text/css"> .tickercontainer { border:1px solid #000; background:#fff; width:638px; height:27px; margin:10px 0; padding:0; overflow:hidden; } .tickercontainer .mask { position:relative; left:10px; top:8px; width:618px; overflow:hidden; } ul.newsticker { position:relative; left:650px; font:bold 10px Verdana; list-style-type:none; margin:0; padding:0; } ul.newsticker li { float:left; margin:0; padding:0; background:#fff; } ul.newsticker a { white-space:nowrap; padding:0; color:#ff0000; font:bold 10px Verdana; margin:0 50px 0 0; } ul.newsticker span { margin:0 10px 0 0; } </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <div id="wrapper"> <h1>設置サンプル</h1> <p>参照: <a href='http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html'>liScroll (a jQuery News Ticker made easy) 1.0</a></p> <p>▼リスト要素をスクロールするニュースティッカーに変換します。</p> <!-- CODE --> <h2>デフォルト</h2> <ul id="ticker01"> <li><span>2009/01/05</span><a href="#">ニュースタイトル5</a></li> <li><span>2009/01/04</span><a href="#">ニュースタイトル4</a></li> <li><span>2009/01/03</span><a href="#">ニュースタイトル3</a></li> <li><span>2009/01/02</span><a href="#">ニュースタイトル2</a></li> <li><span>2009/01/01</span><a href="#">ニュースタイトル1</a></li> </ul> <h2>スクロール速度指定</h2> <ul id="ticker02"> <li><span>2009/01/05</span><a href="#">ニュースタイトル5</a></li> <li><span>2009/01/04</span><a href="#">ニュースタイトル4</a></li> <li><span>2009/01/03</span><a href="#">ニュースタイトル3</a></li> <li><span>2009/01/02</span><a href="#">ニュースタイトル2</a></li> <li><span>2009/01/01</span><a href="#">ニュースタイトル1</a></li> </ul> <!-- / CODE --> </div> </body> </html>