大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 网页设计 -> 网页特效 -> 对联广告代码效果之三[允许关闭]

对联广告代码效果之三[允许关闭]

时间: 2021-07-31 作者:daque

        此刻很多网站告白做的热火朝天,此刻我就来引见一下罕见的春联浮动告白功效的代码运用本领,正文引见的这种功效,在1024*768辨别率下平常表露,在800*600的辨别率下不妨机动湮没,免得遮住页面感化考察者欣赏实质,并且与前方两个代码各别的是,告白图下方减少了一个图片按纽,承诺来访的客人点击封闭告白图片,底下文本框中即是实行功效所需代码: var delta=0.015; var collection; var closeb=false; 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;

     this.items[this.items.length]  = newitem;      }  this.play = function()      {     collection    = this.items     setinterval('play()',30);      }  }  function play()  {   if(screen.width<=800 || closeb)   {    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 = '';   }  }   function closebanner()  {   closeb=true;   return;  }

 var thefloaters  = new floaters(); // thefloaters.additem('followdiv1','document.body.clientwidth-100',0,'<a onclick="closebanner();" href=http://www.dfeng.net target=_blank><img src=http://edu.chinaz.com/get/website/javascript/ad/doublead/right.gif width=100 height=554 border=0></a><br><br><img src=http://edu.chinaz.com/get/website/javascript/ad/doublead/close.gif onclick="closebanner();">'); thefloaters.additem('followdiv2',0,0,'<a onclick="closebanner();" href=http://www.dfeng.net target=_blank><img src=http://edu.chinaz.com/get/website/javascript/ad/doublead/ad_ad.gif width=100 height=400 border=0 ></a><br><br><img src=http://edu.chinaz.com/get/website/javascript/ad/doublead/close.gif onclick="closebanner();">'); thefloaters.play();

把上头的代码另存为一个js文献,而后在想实行此功效的页面用挪用即可,*代办你另存的文献名!提防窜改告白图片地方和贯穿地方!

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.