横向滚动图

时间:2016-03-18 06:51:18
【文件属性】:
文件名称:横向滚动图
文件大小:3KB
文件格式:TXT
更新时间:2016-03-18 06:51:18
滚动 横向滚动图源代码 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <style type="text/css"> *{margin:0;padding:0;} ul{list-style:none} #wrap{width:720px;border:1px solid #999999;height:140px;overflow:hidden;} #a li,#b li{float:left;width:110px;background: #FFFFFF; border:1px solid; border: #999999;height:130px;margin-left:10px; margin-top:10px; margin-bottom:10px} #scrolls{width:200%;float:left;} #a,#b{float:left;} .left,.right{width:20px;height:20px;background:yellow;cursor:pointer;} </style> </head> <body>
[removed] var $ = function(id){return document.getElementById(id)}; var wrap = $("wrap"); var a = $("a"); var b = $("b"); var show = $("show"); var d; b[removed] = a[removed]; function scrolls(){ d = "n"; if(b.offsetWidth - wrap.scrollLeft <=0){ wrap.scrollLeft = wrap.scrollLeft - b.offsetWidth; } else{ wrap.scrollLeft++; } } t = setInterval("scrolls()",30) function backScrolls(){ if(wrap.scrollLeft <=0){ wrap.scrollLeft = wrap.scrollLeft + b.offsetWidth; } else{ wrap.scrollLeft--; } } function left(){ d = "n"; clearT(); t = setInterval("scrolls()",30); } function right(){ d = "m"; clearT(); t = setInterval("backScrolls()",30); } function clearT(){ clearInterval(t); } function runs(){ if(d == "n"){ left(); } else{ right(); } } wrap. (){ clearT(); } wrap. runs(); } [removed]
</body> </html>

网友评论