发表日期:2012-08-19 文章作者:爱永设计 浏览次数:18969 次
代码如下:
boxmove(d1,d2,d3,e,obj)
d1 = 外围容器
d2 = 内容
d3 = 复制d2的内容接替循环滚动
e = 方向与方法
1,2,3,4 = 自动滚动,分别对应:上,右,下,左
“top”,”right”,”bottom”,”left” = 手动滚动,分别对应:上,右,下,左
obj = 选择手动滚动时设置为this,用于事件绑定操作。自动滚动时无须设置。
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” lang=”zh-CN” xml:lang=”zh-CN”>
<head>
<meta name=”keywords” content=”PRcss,xhtml,html,css,js,book,个人主页,无聊,神经,懒惰” />
<meta name=”Author” content=”PRcss,qq:50198763″ />
<meta name=”Copyright” content=”本页版权归PRcss所有。All Rights Reserved” />
<title>滚动合集 – www.poluoluo.com</title>
<script type=”text/javascript”>
// 自动滚动
function boxmove(d1,d2,d3,e,obj){
var speed=30;
var demo=document.getElementById(d1);
var demo1=document.getElementById(d2);
var demo2=document.getElementById(d3);
demo2.innerHTML=demo1.innerHTML;
function boxTop(){
if(demo2.offsetTop-demo.scrollTop<=0){demo.scrollTop-=demo1.offsetHeight}
else{demo.scrollTop++}
}
function boxRight(){
if(demo.scrollLeft<=0){demo.scrollLeft+=demo2.offsetWidth}
else{demo.scrollLeft–}
}
function boxBottom(){
if(demo1.offsetTop-demo.scrollTop>=0){demo.scrollTop+=demo2.offsetHeight}
else{demo.scrollTop–}
}
function boxLeft(){
if(demo2.offsetWidth-demo.scrollLeft<=0){demo.scrollLeft-=demo1.offsetWidth}
else{demo.scrollLeft++}
}
if(e==1){
var MoveTop=setInterval(boxTop,speed);
demo.onmouseover=function(){clearInterval(MoveTop);}
demo.onmouseout=function(){MoveTop=setInterval(boxTop,speed)}
}
if(e==2){
var MoveRight=setInterval(boxRight,speed);
demo.onmouseover=function(){clearInterval(MoveRight)}
demo.onmouseout=function(){MoveRight=setInterval(boxRight,speed)}
}
if(e==3){
var MoveBottom=setInterval(boxBottom,speed);
demo.onmouseover=function(){clearInterval(MoveBottom);}
demo.onmouseout=function(){MoveBottom=setInterval(boxBottom,speed)}
}
if(e==4){
var MoveLeft=setInterval(boxLeft,speed)
demo.onmouseover=function(){clearInterval(MoveLeft)}
demo.onmouseout=function(){MoveLeft=setInterval(boxLeft,speed)}
}
if(e==”top”){
MoveTop=setInterval(boxTop,speed)
obj.onmouseout=function(){clearInterval(MoveTop);}
}
if(e==”right”){
MoveRight=setInterval(boxRight,speed)
obj.onmouseout=function(){clearInterval(MoveRight);}
}
if(e==”bottom”){
MoveBottom=setInterval(boxBottom,speed)
obj.onmouseout=function(){clearInterval(MoveBottom);}
}
if(e==”left”){
MoveLeft=setInterval(boxLeft,speed)
obj.onmouseout=function(){clearInterval(MoveLeft);}
}
}
</script>
<style type=”text/css”>
div#a,div#b,div#c,div#d { float:left;}
h2 { clear:both; }
div#b,div#d,div#bb { white-space:nowrap; }
</style>
</head>
<body>
<h1>滚动合集</h1>
<hr /><h2>向上</h2>
<div id=”a” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”a1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”a2″></div>
</div>
<script type=”text/javascript”>
boxmove(“a”,”a1″,”a2″,1);
</script><h2>向右</h2>
<div id=”b” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”b1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”b2″></div>
</div>
<script type=”text/javascript”>
boxmove(“b”,”b1″,”b2″,2);
</script><h2>向下</h2>
<div id=”c” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”c1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”c2″></div>
</div>
<script type=”text/javascript”>
boxmove(“c”,”c1″,”c2″,3);
</script><h2>向左</h2>
<div id=”d” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”d1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”d2″></div>
</div>
<script type=”text/javascript”>
boxmove(“d”,”d1″,”d2″,4);
</script><h2>手动滚动 – <strong onmouseover=”boxmove(‘aa’,’aa1′,’aa2′,’top’,this);”>上</strong> <strong onmouseover=”boxmove(‘aa’,’aa1′,’aa2′,’bottom’,this);”>下</strong></h2>
<div id=”aa” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”aa1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”aa2″></div>
</div><h2>手动滚动 – <strong onmouseover=”boxmove(‘bb’,’bb1′,’bb2′,’left’,this);”>左</strong> <strong onmouseover=”boxmove(‘bb’,’bb1′,’bb2′,’right’,this);”>右</strong></h2>
<div id=”bb” style=”overflow:hidden;height:100px;width:90px;”>
<div id=”bb1″>
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
<img src=”http://www.poluoluo.com/jzxy/UploadFiles_333/201103/20110320101938325.gif” alt=”” />
</div>
<div id=”bb2″></div>
</div></body>
</html>
日期:2017-08-29 浏览次数:104057 次
日期:2014-03-08 浏览次数:105032 次
日期:2013-12-27 浏览次数:104390 次
日期:2013-11-18 浏览次数:103875 次
日期:2013-09-17 浏览次数:104107 次
开发日期:2021-06-21 浏览次数:682811 次
开发日期:2021-04-21 浏览次数:742607 次
开发日期:2020-05-03 浏览次数:800078 次
开发日期:2019-12-02 浏览次数:778130 次
开发日期:2019-10-02 浏览次数:1037189 次
日期:2013-12-29 浏览次数:186863 次
日期:2013-07-02 浏览次数:13482 次
日期:2014-09-26 浏览次数:14104 次
日期:2019-10-02 浏览次数:400363 次
日期:2021-04-30 浏览次数:142502 次
致力于互联网品牌建设与网络营销,专业领域包括网站建设、网站模板、移动互联网营销、wordpress平台开发等,服务范围涵盖基础的域名服务、主机 服务;企业邮箱、云服务器、网络营销等应用服务,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。
爱永设计工作室一直致力于品牌精美的网页设计、网页制作DIV+CSS布局、JS效果、精美网站模板、标志设计、专业仿站, 低廉的价格,真诚的服务,我们拥有全国各地的客户群体和各行业的成功案例。以一流的服务,出色的网页设计和制作能力,认真严谨的工作态度为客户提供优质满意的服务。期待与您的合作!
Copyright © 2012 - 2024 aysheji.com All Rights Reserved 爱永设计 版权所有
邮箱:aysheji@163.com 在线客服:276583799 模板演示地址:www.aymoban.com 备案号:京ICP备13060102号-3
服务内容: 网页设计 网站建设 网站制作 网站模板 婚庆网站模板 摄影网站 手机网站制作 自适应网站制作