div tag positioning is not working properly
-
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 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.
-
- The topic ‘div tag positioning is not working properly’ is closed to new replies.