DIV CSS 佈局教程網

jQuery News Ticker:快速打造即時新聞跑馬燈展示插件
編輯:JQuery特效代碼     

效果圖如下:

jQuery News Ticker 是一款相當便利的 jQuery 插件,能讓你迅速做出如圖般的新聞行情跑馬燈效果。

它可以透過清單、HTML,甚至 RSS(僅限載入本站 RSS feed)來產生新聞內容,並支援上一則、下一則與暫停播放等操作。這個插件提供了一系列自訂選項,例如:

  • 播放速度
  • 播放效果
  • 播放方向
  • 顯示時間

整體程式碼開發簡單而高效。

使用步驟

首先引入 jQuery News Ticker 的樣式與腳本(別忘了先載入 jQuery 本體):

<link href="css/ticker-style.css" rel="stylesheet" type="text/css" />
<script src="jquery.ticker.js" type="text/javascript"></script>

接著撰寫 HTML 結構:

<div id="ticker-wrapper" class="no-js">
<ul id="js-news" class="js-hidden">
<li class="news-item"><a href="#">This is the 1st latest news item.</a></li>
<li class="news-item"><a href="#">This is the 2nd latest news item.</a></li>
<li class="news-item"><a href="#">This is the 3rd latest news item.</a></li>
<li class="news-item"><a href="#">This is the 4th latest news item.</a></li>
</ul>
</div>

最後以 JavaScript 啟用它:

<script type="text/javascript">
$(function () {
$('#js-news').ticker();
});
</script>

官方網站:https://www.gbin1.com/technology/jquerynews/20111105jquerypluginnewsticker/demo.html

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved