网页中页面浮动图标的简单实现
来源:互联网 发布:手机预装软件卸载 编辑:程序博客网 时间:2024/06/05 18:57
<script language="JavaScript">
var delta=0.5
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y+100;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i<collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i<collection.length;i++)
{
var followObj = collection[i].object;
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = ' ';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><a href="list.asp?id=1437" ><img src=images/left1.gif border=0></a>');
theFloaters.play();
</script>
var delta=0.5
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y+100;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i<collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i<collection.length;i++)
{
var followObj = collection[i].object;
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = ' ';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><a href="list.asp?id=1437" ><img src=images/left1.gif border=0></a>');
theFloaters.play();
</script>
- 网页中页面浮动图标的简单实现
- XHTML中有关浮动图标实现的代码
- 简单的网页浮动窗口
- 网页中实现浮动客服窗口
- 网页中实现浮动客服窗口
- 简单的页面浮动窗口的制作
- 页面添加浮动的图标(带连接)
- 实现网页右侧固定的浮动层
- 简单页面 浮动层
- 网页中加载浮动的广告
- 如何修改网页小图标,浏览器页面上的图标。
- 网页中时光轴的简单实现
- 网页中实现浮动可隐藏客服窗口
- 实现简单浮动层的基本方法
- 网页页面自动刷新的3中实现方式
- JSP页面中实现网页访问量的统计
- Bootstrap实现部分网页中常见的页面效果!
- css3中rotate的使用,网页图标
- URLRewriter问题,使用URL重写的最简单方法
- Hibernate的Query的三种方法比较
- 叶枯过
- c#中使用Enter代替TAB键的方法
- 基于SMPP协议的GSM短消息增值业务接口设计与实现
- 网页中页面浮动图标的简单实现
- CMPP2.0 协议SP端的·NET开发
- 从ASCX页面返回日期给ASPX页面(日期选择用户控件)
- javascript判断下拉菜单值的问题
- 对C学习的认识
- Hibernate Duplicate Import
- C第二天 变量常量
- 软件考试高级资格
- Commons-logging + Log4j 入门指南