<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-46  評論-54  文章-0  trackbacks-0

    1、float.js

     1    var delta=0.35;
     2    var collection;
     3    var closeB=false;
     4    var isScrolling = false;
     5    var bdy = ( document.documentElement && document.documentElement.clientWidth )?document.documentElement:document.body;
     6    
     7        function floaters() {
     8            this.items    =    [];
     9            this.addItem    = function(id,x,y) {
    10                x = bdy.clientWidth/2 + x;
    11                var newItem                        =    {};
    12                newItem.object                    =    document.getElementById(id);
    13                newItem.object.style.left        =    x + "px";
    14                newItem.x                        =    x;
    15                newItem.y                        =    y;
    16
    17                this.items[this.items.length]    =    newItem;
    18            }

    19
    20            this.play = function() {
    21                collection    =    this.items;
    22                var scrollTimeout;
    23                document.body.onscroll = function() {
    24                    isScrolling = true;
    25                    clearTimeout(scrollTimeout);
    26                    scrollTimeout = setTimeout(function() {
    27                        isScrolling = false;
    28                    }
    ,200);
    29                }

    30                setInterval('play()',30);
    31            }

    32        }

    33
    34        function play() {
    35
    36            if(isScrolling==true{
    37                return;
    38            }

    39
    40            if( screen.width<=800 || closeB ) {
    41                for(var i=0; i<collection.length; i++{
    42                    collection[i].object.style.display    = 'none';
    43                }

    44                return;
    45            }

    46
    47            for(var i=0; i<collection.length; i++{
    48                var followObj        = collection[i].object;
    49                var followObj_x        = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
    50                var followObj_y        = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
    51                
    52
    53                
    54                if( followObj.offsetLeft != (bdy.scrollLeft+followObj_x )) {
    55                    var dx = (bdy.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
    56                    dx = (dx>0?1:-1)*Math.ceil(Math.abs(dx));
    57                    tx = followObj.offsetLeft+dx;
    58                    followObj.style.left = tx + "px";
    59                }

    60                
    61
    62                if( followObj.offsetTop != (bdy.scrollTop+followObj_y )) {
    63                    var dy = (bdy.scrollTop+followObj_y-followObj.offsetTop)*delta;
    64                    dy = (dy>0?1:-1)*Math.ceil(Math.abs(dy));
    65                    ty = followObj.offsetTop+dy;
    66                    followObj.style.top = ty + "px";
    67                }

    68
    69                followObj.style.display    = '';
    70            }

    71        }
        
    72
    73        function closeBanner() {
    74            closeB=true;
    75            return;
    76        }

    77


    2、要浮動的層:

     

     1<div id='AdLeftLayer' style='z-index: 10; position: absolute; width: 100px; height: 300px; left: 0px; top: 0px;'> 
     2     <object width="100" height="300"><param name="movie" value="/ad/flash/left.swf"></param><embed src="/ad/flash/left.swf" type="application/x-shockwave-flash" width="100" height="300"></embed></object>
     3</div>
     4<div id='AdRightLayer' style='z-index: 10; position: absolute; width: 100px; height: 300px; left: 0px; top: 0px;'> 
     5     <object width="100" height="300"><param name="movie" value="/ad/flash/right.swf"></param><embed src="/ad/flash/right.swf" type="application/x-shockwave-flash" width="100" height="300"></embed></object>
     6</div>
     7<div id='onlineservice' style='z-index: 10; position: absolute; width:115px; height:95px; left: 0px; top: 0px;'>
     8    <href='http://float2006.tq.cn/static.jsp?uin=8362404&ltype=0' target='_blank'>
     9    <img src='images/kefu.gif' border='0' >
    10    </a>
    11</div>

     

     3、頁面代碼:

     1 <script language="JavaScript" src="/js/float.js"></script>
     2 <script language="javascript">
     3 <!--
     4    var theFloaters        = new floaters();
     5
     6    theFloaters.addItem('AdLeftLayer', -490200 );
     7    theFloaters.addItem('AdRightLayer', 390200 );
     8    theFloaters.addItem('onlineservice', -500 , 80 );
     9    theFloaters.play();
    10 //-->
    11 
    </script>


    效果地址:http://www.jobhn.cn
    因為使用了,

    1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2<html xmlns="http://www.w3.org/1999/xhtml">

    而且,要適應Firefox,必須修改的網上原有代碼的兩個地方:
    1、

    1var bdy = ( document.documentElement && document.documentElement.clientWidth )?document.documentElement:document.body;

    2、

    1followObj.style.left = tx + "px";
    2
    3followObj.style.top = ty + "px";

     

    posted on 2008-05-28 11:01 rox 閱讀(702) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲免费在线观看| 亚洲国产成人乱码精品女人久久久不卡| 久久亚洲国产成人影院网站| 自拍偷自拍亚洲精品偷一| 日韩一级在线播放免费观看| 亚洲爆乳少妇无码激情| 巨胸喷奶水视频www网免费| 亚洲啪AV永久无码精品放毛片| 日本一区二区三区免费高清| 亚洲国产成AV人天堂无码| 性生交片免费无码看人| 亚洲女子高潮不断爆白浆| 四虎影视在线永久免费看黄| 日韩少妇内射免费播放| 亚洲女同成av人片在线观看| 日本在线看片免费| 亚洲激情黄色小说| 久久久www成人免费毛片| 国产亚洲男人的天堂在线观看| 亚洲精品国精品久久99热| a级毛片视频免费观看| 亚洲视频在线免费播放| 一本无码人妻在中文字幕免费| 亚洲av无码成人影院一区| 亚洲色图综合在线| 青青草无码免费一二三区| 亚洲色欲色欲www| 亚洲成av人片天堂网老年人| 免费在线中文日本| 亚洲中文精品久久久久久不卡| 免费中文字幕在线| 久久国产乱子伦精品免费看| 国产 亚洲 中文在线 字幕 | 最近最新MV在线观看免费高清| 亚洲第一街区偷拍街拍| 亚洲色婷婷一区二区三区| 中文字幕无码免费久久99| www免费黄色网| 亚洲人成77777在线观看网| 亚洲日本中文字幕天堂网| 91久久成人免费|