js控制marquee无空白滚动
来源:互联网 发布:淘宝客服排班表 编辑:程序博客网 时间:2024/05/21 07:52
<div id="Parent"
style="cursor: hand; overflow: hidden; width: 800px; height: 50px">
<div id="Child_A" style="float: left; white-space: nowrap;">
<img src="" style="width: 50px; height: 50px;">
<img src="" style="width: 50px; height: 50px;">
|
</div>
</div>
<input type="button" value="stop" onclick="aa.stop()">
<input type="button" value="left" onclick="aa.left()">
<input type="button" value="right" onclick="aa.right()">
//js控制图片移动(marquee无空白左右移动)
<script type="text/javascript">
function Marque() {//js封装类
Marque.prototype.Parent = document.getElementById("Parent");
Marque.prototype.ChildA = document.getElementById("Child_A");
Marque.prototype.parentWidth = Marque.prototype.Parent.offsetWidth;
Marque.prototype.count = 2;
Marque.prototype.ChildA.innerHTML = Marque.prototype.ChildA.innerHTML + " " + Marque.prototype.ChildA.innerHTML;
while (Marque.prototype.Parent.scrollWidth <= Marque.prototype.parentWidth) {
Marque.prototype.count *= 2;
Marque.prototype.ChildA.innerHTML = Marque.prototype.ChildA.innerHTML + " " + Marque.prototype.ChildA.innerHTML;
}
Marque.prototype.speed = 10;
Marque.prototype.flag = "stop";
Marque.prototype.Marqueeleft = function () {
if (Marque.prototype.ChildA.offsetWidth / Marque.prototype.count - Marque.prototype.Parent.scrollLeft <= 0) {
Marque.prototype.Parent.scrollLeft -= Marque.prototype.ChildA.offsetWidth / Marque.prototype.count;
} else {
Marque.prototype.Parent.scrollLeft++;
}
};
Marque.prototype.Marqueeright = function () {
if (Marque.prototype.Parent.scrollLeft <= 0) {
Marque.prototype.Parent.scrollLeft = Marque.prototype.Parent.scrollLeft + Marque.prototype.ChildA.offsetWidth / Marque.prototype.count;
} else {
Marque.prototype.Parent.scrollLeft--;
}
};
Marque.prototype.Myleft = "";
Marque.prototype.Myright = "";
Marque.prototype.stop = function () {
if (Marque.prototype.flag == "stop") {
return true;
}
if (Marque.prototype.flag == "right") {
clearInterval(Marque.prototype.Myright);
Marque.prototype.flag = "stop";
return true;
}
if (Marque.prototype.flag == "left") {
clearInterval(Marque.prototype.Myleft);
Marque.prototype.flag = "stop";
return true;
}
};
Marque.prototype.left = function () {
if (Marque.prototype.flag == "stop") {
Marque.prototype.Myleft = setInterval(Marque.prototype.Marqueeleft, Marque.prototype.speed);
Marque.prototype.flag = "left";
return true;
}
if (Marque.prototype.flag == "right") {
clearInterval(Marque.prototype.Myright);
Marque.prototype.Myleft = setInterval(Marque.prototype.Marqueeleft, Marque.prototype.speed);
Marque.prototype.flag = "left";
return true;
}
if (Marque.prototype.flag == "left") {
return true;
}
};
Marque.prototype.right = function () {
if (Marque.prototype.flag == "stop") {
Marque.prototype.Myright = setInterval(Marque.prototype.Marqueeright, Marque.prototype.speed);
Marque.prototype.flag = "right";
return true;
}
if (Marque.prototype.flag == "right") {
return true;
}
if (Marque.prototype.flag == "left") {
clearInterval(Marque.prototype.Myleft);
Marque.prototype.Myright = setInterval(Marque.prototype.Marqueeright, Marque.prototype.speed);
Marque.prototype.flag = "right";
return true;
}
};
}
var aa=new Marque();
var aa=new Marque();
</script>
- js控制marquee无空白滚动
- JS实现marquee滚动效果
- js信息滚动marquee标签
- js信息滚动marquee标签
- marquee 和JS 滚动效果
- 【js】数据的轮播展示(模拟Marquee,无间断滚动内容)
- 不用marquee而使用JS控制图片纵向滚动,解决火狐不兼容
- 图片无缝滚动 无空白滚动
- JQuery Marquee插件(无缝滚动效果)- marquee.js
- js实现marquee头尾无缝滚动
- 信息滚动(marquee+JS实现)
- 信息滚动(marquee+JS实现)
- 纵向无缝隙滚动显示JS控制代码
- 纵向无缝隙滚动显示JS控制代码
- 纵向无缝隙滚动显示JS控制代码
- marquee 滚动
- marquee滚动
- 无间断滚动marquee的详细用法解析(转)
- MyEclise 配置SVN
- 网站架构文章的网址列表
- Myeclipse配置CVS
- 小扩展,动态加载
- [sql server] sql server 2005 外围应用配置器错误 - 计算机 localhost 在网络上不存在,或无法远程配置该计算机
- js控制marquee无空白滚动
- C#中通过IP获取MAC地址,获取本机IP和MAC地址
- 图片阴影效果
- 嵌入式学习第一篇:Boot-loader
- SQLserver中会用到的命令(随时补充)
- tortoisesvn can't move故障的处理
- ZOJ 1095 Humble Numbers
- 友情链接
- 我要积分