Need help? Check out our Support site, then


div tag positioning is not working properly

  1. Hi There,

    We are trying to make google ad drop in at a particualr place on a post, so we used DIV tag. But the problem is, positioning does not seem to be working properly. Regardless of top:XXXpx value, it always shows up at the header of the page.

    We used below code.

    // Below script is under head tag

    <script language="JavaScript1.2">

    var ie=document.all
    var dom=document.getElementById
    var ns4=document.layers
    var calunits=document.layers? "" : "px"

    var bouncelimit=32 //(must be divisible by 8)
    var direction="up"

    function initbox(){
    if (!dom&&!ie&&!ns4)
    return
    crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    crossobj.top=scroll_top-250+calunits
    crossobj.visibility=(dom||ie)? "visible" : "show"
    dropstart=setInterval("dropin()",50)
    }

    function dropin(){
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    if (parseInt(crossobj.top)<100+scroll_top)
    crossobj.top=parseInt(crossobj.top)+40+calunits
    else{
    clearInterval(dropstart)
    bouncestart=setInterval("bouncein()",50)
    }
    }

    function bouncein(){
    crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
    if (bouncelimit<0)
    bouncelimit+=8
    bouncelimit=bouncelimit*-1
    if (bouncelimit==0){
    clearInterval(bouncestart)
    }
    }

    function dismissbox(){
    if (window.bouncestart) clearInterval(bouncestart)
    crossobj.visibility="hidden"
    }

    function truebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    window.onload=initbox

    </script>

    //below code is in body

    <div id="dropin" style="position:absolute;visibility:hidden;left:200px;top:500px;width:500px;height:300px;background-color:#F5F5F5">

    <div align="right">[Close Box] </div>

    Here text or ad or image or...

    </div>

    Please help. Also advise if this kind of dropin code is allowed for google ads?
    We tested in testing environment and cannot give you a live link for you to see how it behaves in real.

    I will be happy to provide more information as needed.

    Thanks.

  2. I found a solution with div in a div tag. thanks anyway.

Topic Closed

This topic has been closed to new replies.

About this Topic