這篇文章主要介紹了JQuery插件Marquee.js實現(xiàn)無縫滾動效果的相關資料,需要的朋友可以參考下
Marquee.js插件提供了許多屬性選項,您可以配置定制外觀和效果。
{
yScroll: "top" // 初始滾動方向 (還可以是"top" 或 "bottom")
showSpeed: 850 // 初始下拉速度
scrollSpeed: 12 // 滾動速度 ,
pauseSpeed: 5000 // 滾動完到下一條的間隔時間
pauseOnHover: true // 鼠標滑向文字時是否停止?jié)L動
loop: -1 // 設置循環(huán)滾動次數(shù) (-1為無限循環(huán))
fxEasingShow: "swing" // 緩沖效果
fxEasingScroll: "linear" // 緩沖效果
cssShowing: "marquee-showing" //定義class //
event handlers
init: null // 初始調用函數(shù)
beforeshow: null // 滾動前回調函數(shù)
show: null // 當新的滾動內容顯示時回調函數(shù)
aftershow: null // 滾動完了回調函數(shù)
}
詳細代碼:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>marquee測試</title>
<script type="text/javascript" src="../../jquery/jquery.js"></script>
<script type="text/javascript" src="../marquee/lib/jquery.marquee.js"></script>
<script type="text/javascript">
$(function(){
$("#marquee").marquee({
yScroll: "bottom",
showSpeed: 850, // 初始下拉速度 ,
scrollSpeed: 12, // 滾動速度 ,
pauseSpeed: 500, // 滾動完到下一條的間隔時間 ,
pauseOnHover: true, // 鼠標滑向文字時是否停止?jié)L動 ,
loop: -1 , // 設置循環(huán)滾動次數(shù) (-1為無限循環(huán)) ,
fxEasingShow: "swing" , // 緩沖效果 ,
fxEasingScroll: "linear", // 緩沖效果 ,
cssShowing: "marquee-showing" //定義class
});
});
</script>
<style>
ul.marquee {
display: block;
line-height: 1;
position: relative;
overflow: hidden;
width: 400px;
height: 22px;
}
ul.marquee li {
position: absolute;
top: -999em;
left: 0;
display: block;
white-space: nowrap;
padding: 3px 5px;
text-indent:0.8em
}
</style>
</head>
<body >
<ul id="marquee" class="marquee">
<li><a href="#" target="_blank">WEB前端開發(fā)</a> [2011-10-20]</li>
<li><a href="#" target="_blank">架構設計</a> [2011-09-20]</li>
<li><a href="#" target="_blank">系統(tǒng)運維</a> [2011-10-16]</li>
</ul>
</body>
</html>
以上就是本文的全部內容,希望對大家學習jquery程序設計有所幫助。