亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery單行文字向上滾動(dòng)效果示例

 更新時(shí)間:2014年03月06日 17:39:12   作者:  
這篇文章主要介紹了jquery實(shí)現(xiàn)的單行文字向上滾動(dòng)效果,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

<body>
<div id="title" style="width:100%;height:40px;">看看間斷滾動(dòng)文字</div>

<div id="content" class="infocontent">
<div id="top" class="infolist">
<ul>
<li>央視315曝光: 華潤(rùn)深陷“海砂門(mén)”回應(yīng)澄而未清</li>
<li>吉野家被曝餐具不消毒 波司登等羊絨衫不含羊絨</li>
<li>無(wú)錫警方公布“待產(chǎn)女警突發(fā)不幸”事發(fā)經(jīng)過(guò)</li>
<li>中國(guó)人一天:最后的輪渡 視界:在家“搞定”</li>
</ul>
</div>
<div id="bottom" class="infolist"></div>
</div>
<div id="foot"></div>
</body>

復(fù)制代碼 代碼如下:

.infolist{width:400px;matgin:0;}
.infolist ul{margin:0;padding:0;}
.infolist ul li{list-style:none;height:26px;line-height:26px;}
.infocontent{width:400px;height:26px;overflow:hidden;border:1px solid #666666;}

復(fù)制代碼 代碼如下:

var interval=1000;//兩次滾動(dòng)之間的時(shí)間間隔
var stepsize=26;//滾動(dòng)一次的長(zhǎng)度,必須是行高的倍數(shù),這樣滾動(dòng)的時(shí)候才不會(huì)斷行
var objInterval=null;

$(document).ready( function(){
//用上部的內(nèi)容填充下部
$("#bottom").html($("#top").html());

//給顯示的區(qū)域綁定鼠標(biāo)事件
$("#content").bind("mouseover",function(){StopScroll();});
$("#content").bind("mouseout",function(){StartScroll();});

//啟動(dòng)定時(shí)器
StartScroll();
});

//啟動(dòng)定時(shí)器,開(kāi)始滾動(dòng)
function StartScroll(){
objInterval=setInterval("verticalloop()",interval);
}

//清除定時(shí)器,停止?jié)L動(dòng)
function StopScroll(){
window.clearInterval(objInterval);
}

//控制滾動(dòng)
function verticalloop(){
//判斷是否上部?jī)?nèi)容全部移出顯示區(qū)域
//如果是,從新開(kāi)始;否則,繼續(xù)向上移動(dòng)
if($("#content").scrollTop()>=$("#top").outerHeight()){
$("#content").scrollTop($("#content").scrollTop()-$("#top").outerHeight());
}
//使用jquery創(chuàng)建滾動(dòng)時(shí)的動(dòng)畫(huà)效果
$("#content").animate(
{"scrollTop" : $("#content").scrollTop()+stepsize +"px"},600,function(){
//這里用于顯示滾動(dòng)區(qū)域的scrollTop,實(shí)際應(yīng)用中請(qǐng)刪除
// $("#foot").html("scrollTop:"+$("#content").scrollTop());
});
}

相關(guān)文章

最新評(píng)論