JS實(shí)現(xiàn)圖片橫向滾動(dòng)效果示例代碼
更新時(shí)間:2013年09月04日 16:35:06 作者:
圖片橫向滾動(dòng)效果,大家可能都已經(jīng)很熟悉了,本文為大家介紹下使用js實(shí)現(xiàn)橫向滾動(dòng)效果,喜歡的朋友可以參考下,希望對大家有所幫助
復(fù)制代碼 代碼如下:
<!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=gb2312" />
<title>圖片橫向滾動(dòng)代碼</title>
<!-----------圖片Block的樣式-------------->
<style type="text/css">
.box{ margin:0 auto; height:70px; width:810px; padding:10px; border:1px solid #FF0000; }
.box img{ margin-right:20px;}
#goleft {width: 800px;height: 70px;overflow: hidden;}
#goleft #gols {width: 33100px;}
#goleft1, #goleft2 {width: auto;float: left;}
</style>
</head>
<body>
<!-----------圖片橫向滾動(dòng)Block-------------->
<div class="box">
<div id="goleft">
<div id="gols">
<div id="goleft1">
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011700784.jpg" alt="6" width="100" height="70" /></a>
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011612885.jpg" alt="5" width="100" height="70" /></a>
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011552639.jpg" alt="4" width="100" height="70" /></a>
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011502241.jpg" alt="3" width="100" height="70" /></a>
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011344231.jpg" alt="2" width="100" height="70" /></a>
<a href="" ><img src="http://image.cnicif.com/big/2013/5/14/jpg20130514011113601.jpg" alt="1" width="100" height="70" /></a>
</div>
<div id="goleft2"></div>
</div>
</div>
</div>
<!-----------圖片滾動(dòng)結(jié)束-------------->
<script type="text/javascript">
//圖片滾動(dòng)JS代碼
var speed2=20;
var FGgoleft=document.getElementById('goleft');
var FGgoleft1=document.getElementById('goleft1');
var FGgoleft2=document.getElementById('goleft2');
FGgoleft2.innerHTML=FGgoleft1.innerHTML
function Marquee2(){
if(FGgoleft2.offsetWidth-FGgoleft.scrollLeft<=0)
{
FGgoleft.scrollLeft-=FGgoleft1.offsetWidth
}
else{
FGgoleft.scrollLeft++;
}
}
var MyMar2=setInterval(Marquee2,speed2)
FGgoleft.onmouseover=function() { clearInterval(MyMar2) }
FGgoleft.onmouseout=function() { MyMar2=setInterval(Marquee2,speed2) }
</script>
</body>
</html>
效果:

您可能感興趣的文章:
- JS實(shí)現(xiàn)長圖上下滾動(dòng)效果
- JS圖片無縫、平滑滾動(dòng)代碼
- js實(shí)現(xiàn)圖片無縫滾動(dòng)特效
- 用js實(shí)現(xiàn)的一個(gè)Flash滾動(dòng)輪換顯示圖片代碼生成器
- JS實(shí)現(xiàn)div內(nèi)部的文字或圖片自動(dòng)循環(huán)滾動(dòng)代碼
- div+css布局的圖片連續(xù)滾動(dòng)js實(shí)現(xiàn)代碼
- js jquery做的圖片連續(xù)滾動(dòng)代碼
- JavaScript代碼實(shí)現(xiàn)圖片循環(huán)滾動(dòng)效果
- js實(shí)現(xiàn)圖片左右滾動(dòng)效果
- JavaScript實(shí)現(xiàn)長圖滾動(dòng)效果
相關(guān)文章
單線程JavaScript實(shí)現(xiàn)異步過程詳解
這篇文章主要介紹了單線程JavaScript實(shí)現(xiàn)異步過程詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05面試判斷元素是否在可視區(qū)域中IntersectionObserver詳解
這篇文章主要為大家介紹了判斷元素是否在可視區(qū)域中IntersectionObserver面試詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03微信小程序基于slider組件動(dòng)態(tài)修改標(biāo)簽透明度的方法示例
這篇文章主要介紹了微信小程序基于slider組件動(dòng)態(tài)修改標(biāo)簽透明度的方法,可通過slider組件拖動(dòng)實(shí)現(xiàn)圖片透明度的改變功能,涉及微信小程序事件綁定、base64格式圖片載入及slider組件使用技巧,需要的朋友可以參考下2017-12-12js實(shí)現(xiàn)省市聯(lián)動(dòng)效果的簡單實(shí)例
本篇文章主要是對js實(shí)現(xiàn)省市聯(lián)動(dòng)效果的簡單實(shí)例進(jìn)行了介紹,需要的朋友可以過來,希望對大家有所幫助2014-02-02B/S開發(fā)中常用javaScript技術(shù)與代碼
B/S開發(fā)中常用javaScript技術(shù)與代碼...2007-03-03