仿天涯底部固定漂浮导航

原文地址:http://www.uecss.com/index.php/fixed-floating-imitation-navigation/

 

Code
body {
background-image
:url(text.txt); /* for IE6 */
background-attachment
:fixed;
}
#bottomNav 
{
background-color
:#096;
z-index
:999;
position
:fixed;
bottom
:0;
left
:0;
width
:100%;
_position
:absolute; /* for IE6 */
_top
: expression(documentElement.scrollTop + documentElement.clientHeight-this.offsetHeight); /* for IE6 */
overflow
:visible;
}
HTML部分加上这个id为 #bottomNav 的DIV即可:

Code
<div id=”bottomNav”>固定漂浮物在此处O(∩_∩)O~</div>
再看看这些需要注意的地方:

Code
_top: expression(documentElement.scrollTop + documentElement.clientHeight-this.offsetHeight);
看到 _top 大家都知道是为IE6独家准备的,但是当我只加了上面这句时,IE6下拉动滚动条看到的这个漂浮物是抖动的-_-|||
解决方法我们为IE6添加这样一条语句:

Code
background-image:url(text.txt);

注意这里的 text.txt 其实不需要有这个txt文档,txt的文件名叫什么看自己喜好喽,如此一来我们就解决了IE6下的缓动问题。

PS:你可能会对 text.txt 和 expression 感到郁闷,也有人使用多嵌套一层 DIV 做了个假滚动条实现了这个方法,当然这种方法在也会相应的改动下默认属性,可这种写法和之前网站融合起来很郁闷,要添加一个DIV(因为我之前没有在最外 层写DIV.wrap)。

posted @ 2009-07-06 11:01  db's jim  阅读(142)  评论(0)    收藏  举报