码迷,mamicode.com
首页 > Web开发 > 详细

除ie6-浏览器---无缝上下左右交叉运动----原生js+css

时间:2016-08-13 20:53:16      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

 

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>

*{padding:0;margin:0;}
img{vertical-align:top;border:none;}
a{text-decoration:none;}
#Left {
float:left;
margin:150px 0 0 0;
background: #FFF;
overflow:hidden;
border: 0px dashed #CCC;
width: 500px;
height:150px;
border:5px solid #ccc;
zoom:1;
}


#Top { float:left; margin:50px auto; background: #FFF; overflow:hidden; border: 0px dashed #CCC; height: 500px; width: 150px; border:5px solid #ccc; zoom:1; } #Left ._left { float: left; width: 500%; } #Top ._left { float: left; width: 100%; } #_left1,#_left3 { float: left; border:5px solid #F00; } #_left2,#_left4 { float: left; border:5px solid blue; } #_left1 img,#_left2 img,#_left3 img,#_left4 img{ width:128px; height:128px; border:5px solid pink; } #Right { float:left; margin:150px 0 0 0; background: #FFF; overflow:hidden; border: 0px dashed #CCC; width: 500px; height:150px; border:5px solid #ccc; }

#Bottom { float:left; margin:-250px 0 0 510px; background: #FFF; overflow:hidden; border: 0px dashed #CCC; height: 500px; width: 150px; border:5px solid #ccc; } #Right ._right { float: left; width: 500%; } #Bottom ._right { float: left; width: 100%; } #_right1,#_right3 { float: left; border:5px solid #F00; } #_right2,#_right4 { float: left; border:5px solid blue; } #_right1 img,#_right2 img,#_right3 img,#_right4 img{ width:128px; height:128px; border:5px solid pink; } </style> <script> window.onload=function(){ var oLeft=document.getElementById(Left); var oLeft1=document.getElementById(_left1); var oLeft2=document.getElementById(_left2); oLeft2.innerHTML=oLeft1.innerHTML; var oTop=document.getElementById(Top); var oLeft3=document.getElementById(_left3); var oLeft4=document.getElementById(_left4); oLeft4.innerHTML=oLeft3.innerHTML; function Move(){ if(oLeft.scrollLeft>=oLeft1.offsetWidth) oLeft.scrollLeft-=oLeft1.offsetWidth; else{ oLeft.scrollLeft++; } } function Move1(){ if(oTop.scrollTop>=oLeft3.offsetHeight) oTop.scrollTop-=oLeft3.offsetHeight; else{ oTop.scrollTop++; } } var timer=setInterval(Move,1); var timer1=setInterval(Move1,1); oLeft.onmouseover=function() {clearInterval(timer)}; oLeft.onmouseout=function() {timer=setInterval(Move,1)}; oTop.onmouseover=function() {clearInterval(timer1)}; oTop.onmouseout=function() {timer1=setInterval(Move1,1)}; var oRight=document.getElementById(Right); var oRight1=document.getElementById(_right1); var oRight2=document.getElementById(_right2); oRight2.innerHTML=oRight1.innerHTML; var oBottom=document.getElementById(Bottom); var oRight3=document.getElementById(_right3); var oRight4=document.getElementById(_right4); oRight4.innerHTML=oRight3.innerHTML; function Move2(){ if(oRight.scrollLeft<=0) oRight.scrollLeft+=oRight1.offsetWidth; else{ oRight.scrollLeft--; } } function Move3(){ if(oBottom.scrollTop<=0) oBottom.scrollTop+=oRight3.offsetHeight; else{ oBottom.scrollTop--; } } var timer2=setInterval(Move2,1); var timer3=setInterval(Move3,1); oRight.onmouseover=function() {clearInterval(timer2)}; oRight.onmouseout=function() {timer2=setInterval(Move2,1)}; oBottom.onmouseover=function() {clearInterval(timer3)}; oBottom.onmouseout=function() {timer3=setInterval(Move3,1)}; }; </script> </head> <body> <div id="Left"> <div class="_left"> <div id="_left1"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_left2"></div> </div> </div> <div id="Top"> <div class="_left"> <div id="_left3"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_left4"></div> </div> </div> <div id="Right"> <div class="_right"> <div id="_right1"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_right2"></div> </div> </div> <div id="Bottom"> <div class="_right"> <div id="_right3"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_right4"></div> </div> </div> <script language=JavaScript src="cat/my.js"></script> </body> ---恢复内容结束--- <!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style> *{padding:0;margin:0;} img{vertical-align:top;border:none;} a{text-decoration:none;} #Left { float:left; margin:150px 0 0 0; background: #FFF; overflow:hidden; border: 0px dashed #CCC; width: 500px; height:150px; border:5px solid #ccc; zoom:1; } /*Download by http://sc.xueit.com*/ #Top { float:left; margin:50px auto; background: #FFF; overflow:hidden; border: 0px dashed #CCC; height: 500px; width: 150px; border:5px solid #ccc; zoom:1; } #Left ._left { float: left; width: 500%; } #Top ._left { float: left; width: 100%; } #_left1,#_left3 { float: left; border:5px solid #F00; } #_left2,#_left4 { float: left; border:5px solid blue; } #_left1 img,#_left2 img,#_left3 img,#_left4 img{ width:128px; height:128px; border:5px solid pink; } #Right { float:left; margin:150px 0 0 0; background: #FFF; overflow:hidden; border: 0px dashed #CCC; width: 500px; height:150px; border:5px solid #ccc; } /*Download by http://sc.xueit.com*/ #Bottom { float:left; margin:-250px 0 0 510px; background: #FFF; overflow:hidden; border: 0px dashed #CCC; height: 500px; width: 150px; border:5px solid #ccc; } #Right ._right { float: left; width: 500%; } #Bottom ._right { float: left; width: 100%; } #_right1,#_right3 { float: left; border:5px solid #F00; } #_right2,#_right4 { float: left; border:5px solid blue; } #_right1 img,#_right2 img,#_right3 img,#_right4 img{ width:128px; height:128px; border:5px solid pink; } </style> <script> window.onload=function(){ var oLeft=document.getElementById(Left); var oLeft1=document.getElementById(_left1); var oLeft2=document.getElementById(_left2); oLeft2.innerHTML=oLeft1.innerHTML; var oTop=document.getElementById(Top); var oLeft3=document.getElementById(_left3); var oLeft4=document.getElementById(_left4); oLeft4.innerHTML=oLeft3.innerHTML; function Move(){ if(oLeft.scrollLeft>=oLeft1.offsetWidth) oLeft.scrollLeft-=oLeft1.offsetWidth; else{ oLeft.scrollLeft++; } } function Move1(){ if(oTop.scrollTop>=oLeft3.offsetHeight) oTop.scrollTop-=oLeft3.offsetHeight; else{ oTop.scrollTop++; } } var timer=setInterval(Move,1); var timer1=setInterval(Move1,1); oLeft.onmouseover=function() {clearInterval(timer)}; oLeft.onmouseout=function() {timer=setInterval(Move,1)}; oTop.onmouseover=function() {clearInterval(timer1)}; oTop.onmouseout=function() {timer1=setInterval(Move1,1)}; var oRight=document.getElementById(Right); var oRight1=document.getElementById(_right1); var oRight2=document.getElementById(_right2); oRight2.innerHTML=oRight1.innerHTML; var oBottom=document.getElementById(Bottom); var oRight3=document.getElementById(_right3); var oRight4=document.getElementById(_right4); oRight4.innerHTML=oRight3.innerHTML; function Move2(){ if(oRight.scrollLeft<=0) oRight.scrollLeft+=oRight1.offsetWidth; else{ oRight.scrollLeft--; } } function Move3(){ if(oBottom.scrollTop<=0) oBottom.scrollTop+=oRight3.offsetHeight; else{ oBottom.scrollTop--; } } var timer2=setInterval(Move2,1); var timer3=setInterval(Move3,1); oRight.onmouseover=function() {clearInterval(timer2)}; oRight.onmouseout=function() {timer2=setInterval(Move2,1)}; oBottom.onmouseover=function() {clearInterval(timer3)}; oBottom.onmouseout=function() {timer3=setInterval(Move3,1)}; }; </script> </head> <body> <div id="Left"> <div class="_left"> <div id="_left1"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_left2"></div> </div> </div> <div id="Top"> <div class="_left"> <div id="_left3"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_left4"></div> </div> </div> <div id="Right"> <div class="_right"> <div id="_right1"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_right2"></div> </div> </div> <div id="Bottom"> <div class="_right"> <div id="_right3"> <a href="javascrippt:;"><img src="cat/1.jpg" /></a> <a href="javascrippt:;"><img src="cat/2.jpg" /></a> <a href="javascrippt:;"><img src="cat/3.jpg" /></a> <a href="javascrippt:;"><img src="cat/4.jpg" /></a> </div> <div id="_right4"></div> </div> </div> <script language=JavaScript src="cat/my.js"></script> </body>

 

除ie6-浏览器---无缝上下左右交叉运动----原生js+css

标签:

原文地址:http://www.cnblogs.com/lixuekui/p/5768701.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!