被困在屏幕底部的浮动广告横幅

时间:2015-06-16 17:42:54

标签: javascript html css adsense

我有一个让我难过的快速问题。在this page我在屏幕底部有一个用于Google广告的浮动横幅广告。在我的桌面上,以下代码正常运行:

<div style="left:0;position: fixed;text-align:center;bottom: 0px;width:100%;z-index:9999;">

   <!-- GOOGLE AD CODE -->

</div>

广告应该浮动在页面底部并在滚动时保持在那里。但是,当我切换到iPhone时,横幅只会停留在屏幕底部。

3 个答案:

答案 0 :(得分:0)

也许添加这个

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />

答案 1 :(得分:0)

尝试同时给你的身体或广告在相对位置内的任何DIV:

#main-wrap {
  position: relative;
}

<div style="left:0px; position:absolute; text-align:center; bottom: 0px;width:100%; z-index:9999;">.....</div>

在这种情况下,它看起来像这样,Ad div的绝对位置和内容容器的相对位置。 http://pasteboard.co/1gPmvBoK.png

答案 2 :(得分:0)

试试这个

#footer{
position:fixed;
left:0px;
bottom:0px;
height:30px;
width:100%;
background:#999;
}
#footer{
position:absolute;
top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}   

来自http://www.flashjunior.ch/school/footers/fixed.cfm