仿豬八戒網(wǎng)左下角的文字滾動效果
更新時間:2011年10月28日 23:56:45 作者:
覺得豬八戒網(wǎng)左下角的文字滾動,效果不錯!自己摸索了一下,以自己的方法實(shí)現(xiàn)了!沒有運(yùn)用jQuery,不過用了自己的編寫的Js庫!
源碼:
css:
*{padding:0;margin:0;font-size:12px;}
.do_ta { border: 1px solid #E4E4E4; margin:10px auto; width:170px; }
.do_ta .ta_ta { background: url("http://s.zbjimg.com/p/zbj/css/../img/tafb.gif") no-repeat; height: 52px; width: 168px; }
.do_ta .ta_tc { height: 61px; line-height: 20px; margin: 10px; overflow: hidden; padding: 0;position:relative; }
.do_ta .ta_tc li { border-bottom: 1px dashed #E4E4E4; color: #666666; height: 60px; margin: 0; overflow: hidden; padding: 0;position:absolute;top:0;left:0;background:#fff;z-index:0;width:155px; }
.do_ta .ta_tc li .time { color: #999999; }
.do_ta .ta_tc li u { color: #2B9A00; text-decoration:none;}
.do_ta .ta_tc li s { color: #FF3600; text-decoration:none;}
.do_ta .ta_tc li a { color: #1A69DE;text-decoration:none; }
.do_ta .dota_d { padding: 5px 0 15px; text-align: center; }
.do_ta .dota_d a{color:#666;}
javascript:
個人js工具庫,猛點(diǎn)擊!
Meng.extend({
zbjScrollText:function(scrollId){
var li = Meng.getTag('li',Meng.getId(scrollId)),
curActLi = 0,
getActivity = function(){
return [li[curActLi],li[10+curActLi],li[20+curActLi],li[30+curActLi]];
},
sliceDown = function(elem,pos){
Meng.setStyle(elem,{top:'-60px',zIndex:1});
Meng.animate(elem,{top:-60},{top:60},800);
},
play = function(){
Meng.each(getActivity(),function(i){
var _this = this;
setTimeout(function(){
sliceDown(_this,i);
},i*900);
});
};
play();
setInterval(function(){
if(curActLi == 9){
curActLi = 0;
Meng.each(li,function(){Meng.setStyle(this,{zIndex:0})});
}else curActLi++;
play();
},5000);
}
});
Meng.zbjScrollText('dota1');
css:
復(fù)制代碼 代碼如下:
*{padding:0;margin:0;font-size:12px;}
.do_ta { border: 1px solid #E4E4E4; margin:10px auto; width:170px; }
.do_ta .ta_ta { background: url("http://s.zbjimg.com/p/zbj/css/../img/tafb.gif") no-repeat; height: 52px; width: 168px; }
.do_ta .ta_tc { height: 61px; line-height: 20px; margin: 10px; overflow: hidden; padding: 0;position:relative; }
.do_ta .ta_tc li { border-bottom: 1px dashed #E4E4E4; color: #666666; height: 60px; margin: 0; overflow: hidden; padding: 0;position:absolute;top:0;left:0;background:#fff;z-index:0;width:155px; }
.do_ta .ta_tc li .time { color: #999999; }
.do_ta .ta_tc li u { color: #2B9A00; text-decoration:none;}
.do_ta .ta_tc li s { color: #FF3600; text-decoration:none;}
.do_ta .ta_tc li a { color: #1A69DE;text-decoration:none; }
.do_ta .dota_d { padding: 5px 0 15px; text-align: center; }
.do_ta .dota_d a{color:#666;}
javascript:
個人js工具庫,猛點(diǎn)擊!
復(fù)制代碼 代碼如下:
Meng.extend({
zbjScrollText:function(scrollId){
var li = Meng.getTag('li',Meng.getId(scrollId)),
curActLi = 0,
getActivity = function(){
return [li[curActLi],li[10+curActLi],li[20+curActLi],li[30+curActLi]];
},
sliceDown = function(elem,pos){
Meng.setStyle(elem,{top:'-60px',zIndex:1});
Meng.animate(elem,{top:-60},{top:60},800);
},
play = function(){
Meng.each(getActivity(),function(i){
var _this = this;
setTimeout(function(){
sliceDown(_this,i);
},i*900);
});
};
play();
setInterval(function(){
if(curActLi == 9){
curActLi = 0;
Meng.each(li,function(){Meng.setStyle(this,{zIndex:0})});
}else curActLi++;
play();
},5000);
}
});
Meng.zbjScrollText('dota1');
您可能感興趣的文章:
- Android實(shí)現(xiàn)文字滾動效果
- js實(shí)現(xiàn)文字滾動效果
- js+div實(shí)現(xiàn)文字滾動和圖片切換效果代碼
- js焦點(diǎn)文字滾動效果代碼分享
- JS實(shí)現(xiàn)倒計(jì)時和文字滾動的效果實(shí)例
- js 動態(tài)文字滾動的例子
- 基于Jquery的文字滾動跑馬燈插件(一個頁面多個滾動區(qū))
- js 上下文字滾動效果
- 淺析js 文字滾動效果
- Marquee配合DIV實(shí)現(xiàn)的文字滾動效果代碼
- js文字滾動停頓效果代碼
- 如何讓一個方框欄內(nèi)的文字滾動顯示?
- 一個非常好用的文字滾動的案例,鼠標(biāo)懸浮可暫停[兩種方案任選]
相關(guān)文章
JavaScript省市聯(lián)動實(shí)現(xiàn)代碼
這篇文章主要介紹了JavaScript省市聯(lián)動實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-02-02
js實(shí)現(xiàn)鼠標(biāo)滑動到某個div禁止?jié)L動
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)鼠標(biāo)滑動到某個div禁止?jié)L動,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-09-09
基于rollup的組件庫打包體積優(yōu)化小結(jié)
這篇文章主要介紹了基于rollup的組件庫打包體積優(yōu)化小結(jié),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-06-06
輕松實(shí)現(xiàn)jquery手風(fēng)琴效果
這篇文章主要為大家介紹了實(shí)現(xiàn)jquery手風(fēng)琴效果的詳細(xì)代碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-01-01
淺談Javascript中substr和substring的區(qū)別
這篇文章主要介紹了Javascript中substr和substring的區(qū)別,非常的簡單明了,有需要的小伙伴可以來仔細(xì)看看。2015-09-09

