浮动DIV不固定

时间:2014-08-08 11:33:49

标签: javascript

我在我的网站上安装了Float Left Right Advertising插件:www.displej.me我在网站侧面设置横幅广告。但是当你滚动baners没有修复时,它们会跟随页面,但它们会刷新并闪烁。此外,当我向下滚动时,它们会被固定在一边,然后开始关注页面。这是JS代码:

function FloatTopDiv() 
{ 
    startLX = ((document.body.clientWidth -MainContentW)/2) - (LeftBannerW+LeftAdjust) , startLY = TopAdjust; 
    startRX = ((document.body.clientWidth -MainContentW)/2) + (MainContentW+RightAdjust) , startRY = TopAdjust; 
    var d = document; 
    function ml(id) 
    { 
        var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
        el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
        el.x = startRX; 
        el.y = startRY; 
        return el; 
    } 
    function m2(id) 
    { 
        var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
        e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
        e2.x = startLX; 
        e2.y = startLY; 
        return e2; 
    } 
    window.stayTopLeft=function() 
    { 
        if (document.documentElement && document.documentElement.scrollTop) 
            var pY =  document.documentElement.scrollTop; 
        else if (document.body) 
            var pY =  document.body.scrollTop; 
        if (document.body.scrollTop > 200){startLY = 3;startRY = 3;} else {startLY = TopAdjust;startRY = TopAdjust;}; 
        ftlObj.y += (pY+startRY-ftlObj.y)/1; 
        ftlObj.sP(ftlObj.x, ftlObj.y); 
        ftlObj2.y += (pY+startLY-ftlObj2.y)/1; 
        ftlObj2.sP(ftlObj2.x, ftlObj2.y); 
        setTimeout("stayTopLeft()", 1); 
    } 
    ftlObj = ml("divAdRight"); 
    //stayTopLeft(); 
    ftlObj2 = m2("divAdLeft"); 
    stayTopLeft(); 
} 
function ShowAdDiv() 
{ 
    var objAdDivRight = document.getElementById("divAdRight"); 
    var objAdDivLeft = document.getElementById("divAdLeft");        
    objAdDivRight.style.display = "block"; 
    objAdDivLeft.style.display = "block"; 
    FloatTopDiv(); 
}

怎么办?我尝试更改代码中的数字,但不是更改。

1 个答案:

答案 0 :(得分:0)

  

明确的:既

是我试图保持双方摆脱中心div运动的东西。