js文字滾動停頓效果代碼
更新時間:2008年06月28日 17:16:36 作者:
javascript文字滾動停頓效果的實現(xiàn)代碼
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>間斷滾動_www.dbjr.com.cn_腳本之家</title>
<style>
#Marquee{ height:60px; overflow:hidden;}
#Marquee div{ border:1px solid #DDD3FE; background:#EEECF4; height:58px;}
</style>
</head>
<body>
<div id="Marquee">
<div style="width: 160px; height: 58px">間斷-1-caiying2007</div>
<div style="width: 160px; height: 58px">間斷-2-caiying2007</div>
<div style="width: 160px; height: 58px">間斷-3-caiying2007</div>
</div>
<script>
var Mar = document.getElementById("Marquee");
var child_div=Mar.getElementsByTagName("div")
var picH = 60;//移動高度
var scrollstep=3;//移動步幅,越大越快
var scrolltime=20;//移動頻度(毫秒)越大越慢
var stoptime=3000;//間斷時間(毫秒)
var tmpH = 0;
Mar.innerHTML += Mar.innerHTML;
function start(){
if(tmpH < picH){
tmpH += scrollstep;
if(tmpH > picH )tmpH = picH ;
Mar.scrollTop = tmpH;
setTimeout(start,scrolltime);
}else{
tmpH = 0;
Mar.appendChild(child_div[0]);
Mar.scrollTop = 0;
setTimeout(start,stoptime);
}
}
onload=function(){setTimeout(start,stoptime)};
</script></body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>間斷滾動_www.dbjr.com.cn_腳本之家</title>
<style>
#Marquee{ height:60px; overflow:hidden;}
#Marquee div{ border:1px solid #DDD3FE; background:#EEECF4; height:58px;}
</style>
</head>
<body>
<div id="Marquee">
<div style="width: 160px; height: 58px">間斷-1-caiying2007</div>
<div style="width: 160px; height: 58px">間斷-2-caiying2007</div>
<div style="width: 160px; height: 58px">間斷-3-caiying2007</div>
</div>
<script>
var Mar = document.getElementById("Marquee");
var child_div=Mar.getElementsByTagName("div")
var picH = 60;//移動高度
var scrollstep=3;//移動步幅,越大越快
var scrolltime=20;//移動頻度(毫秒)越大越慢
var stoptime=3000;//間斷時間(毫秒)
var tmpH = 0;
Mar.innerHTML += Mar.innerHTML;
function start(){
if(tmpH < picH){
tmpH += scrollstep;
if(tmpH > picH )tmpH = picH ;
Mar.scrollTop = tmpH;
setTimeout(start,scrolltime);
}else{
tmpH = 0;
Mar.appendChild(child_div[0]);
Mar.scrollTop = 0;
setTimeout(start,stoptime);
}
}
onload=function(){setTimeout(start,stoptime)};
</script></body>
</html>
相關(guān)文章
uniapp原生tabbar設(shè)置并添加數(shù)字角標(biāo)或小紅點(diǎn)提示功能
這篇文章主要給大家介紹了關(guān)于uniapp原生tabbar設(shè)置并添加數(shù)字角標(biāo)或小紅點(diǎn)提示功能的相關(guān)資料,在相應(yīng)的頁面中完成對消息的處理,如果有新消息,則在tabBar頁面中顯示紅點(diǎn)提醒用戶,需要的朋友可以參考下2023-08-08Javascript筆記一 js以及json基礎(chǔ)使用說明
JavaScript中的數(shù)據(jù)很簡潔的。簡單數(shù)據(jù)只有 undefined, null, boolean, number和string這五種,而復(fù)雜數(shù)據(jù)只有一種,即object。2010-05-05JavaScript下的時間格式處理函數(shù)Date.prototype.format
這篇文章主要介紹了JavaScript下的時間格式處理函數(shù)Date.prototype.format的相關(guān)資料,需要的朋友可以參考下2016-01-01淺談Webpack4 Tree Shaking 終極優(yōu)化指南
這篇文章主要介紹了淺談Webpack4 Tree Shaking 終極優(yōu)化指南,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11js讀取被點(diǎn)擊次數(shù)的簡單實例(從數(shù)據(jù)庫中讀取)
這篇文章主要介紹了js讀取被點(diǎn)擊次數(shù)的簡單實例(從數(shù)據(jù)庫中讀取)。需要的朋友可以過來參考下,希望對大家有所幫助2014-03-03js實現(xiàn)為a標(biāo)簽添加事件的方法(使用閉包循環(huán))
這篇文章主要介紹了js實現(xiàn)為a標(biāo)簽添加事件的方法,基于閉包循環(huán)實現(xiàn)事件添加的功能,涉及javascript閉包與事件操作相關(guān)技巧,需要的朋友可以參考下2016-08-08