JS横向无缝滚动效果
来源:互联网 发布:数据截取 威布尔分布 编辑:程序博客网 时间:2024/05/22 15:35
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.clearfix:after {content:"."; display:block; height:0; visibility:hidden; clear:both; }
.clearfix { *zoom:1; }
#wrap{
width:810px;
height:160px;
border:1px solid red;
position:relative;
left:50%;
top:50%;
margin-left:-410px;
margin-top:200px;
background:#fff;
overflow:hidden;
}
#wrap ul{
margin:0px;
padding:0px;
position:absolute;
top:0px;
left:0px;
}
#wrap ul li{ list-style:none; float:left;margin:5px 10px;width:265px;}
#wrap ul li img{ border:1px black solid; padding:10px;}
</style>
<script type="text/javascript">
function Slide(obj,direction,speed){ //面向对象的方法,可以自由控制方向,speed=>3 ie下可以
this.container=document.getElementById(obj);
this.content=this.container.getElementsByTagName("ul")[0];
this.lis=this.content.getElementsByTagName("li");
this.content.innerHTML+=this.content.innerHTML;
this.content.style.width=(this.lis[0].offsetWidth+20)*this.lis.length+"px";
var that=this
if(direction=="left"){
this.speed=-speed
}else if(direction=="right"){
this.speed=speed
}
Slide.prototype.scroll=function(){
this.content.style.left=this.content.offsetLeft+this.speed+"px";
if(this.content.offsetLeft <= -this.content.offsetWidth/2){
this.content.style.left ="0px";
}else if(this.content.offsetLeft >=0){
this.content.style.left = -this.content.offsetWidth/2 + "px";
}
}
this.time=setInterval(function(){that.scroll()},100);
this.container.onmouseover=function(){
clearInterval(that.time);
}
this.container.onmouseout=function(){
that.time=setInterval(function(){that.scroll()},100);
}
}
window.onload=function(){new Slide("wrap","left",5)}
</script>
</head>
<body>
<div id="wrap">
<ul class="clearfix">
<li><a href="#"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="border:1px solid red;" /></a></li>
<li><a href="#"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="border:1px solid red;" /></a></li>
<li><a href="#"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="border:1px solid red;" /></a></li>
<li><a href="#"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="border:1px solid red;" /></a></li>
<li><a href="#"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="border:1px solid red;" /></a></li>
</ul>
</div>
</body>
</html>
- JS横向无缝滚动效果
- JS实现横向图片无缝滚动
- js图片无缝滚动效果
- js实现无缝滚动效果
- JS效果 - 无缝滚动/滚动加停顿
- 图片无缝滚动(横向)
- 图片横向无缝滚动
- css3实现图片横向无缝滚动的效果
- 无缝滚动效果 js可以实现
- js大图匀速无缝滚动效果
- JS实现图片无缝滚动效果
- JS图片滚动(无缝、平滑、上下左右滚动)效果
- JS实现图片滚动(无缝、平滑、上下左右滚动)效果
- 文字无缝滚动jQuery上下滚动js效果代码
- 无缝图片滚动效果...
- 无缝滚动图片效果
- 无缝滚动效果代码
- css3无缝滚动效果
- 程序员如何挑选自己的专业方向
- {单片机}之 单片机中C和汇编混合编程
- 关闭弹出窗口,刷新父窗口
- C# 获取硬盘空间信息 盘符总大小、剩余空间、已用空间
- Linux下SSH跳转无密码登录或执行命令
- JS横向无缝滚动效果
- 学外语的十条经验
- cygwin安装,NDK配置,samples下demo调试,以及手写测试程序
- 对list列表分页
- hadoop集群内lzo的安装与配置
- Linux awk 命令 说明
- Android 工程中各种文件的介绍
- LTE L3 study
- android4.0.3源码之鼠标光标绘制简略版