在IE6

2010-04-21 67 views
0

伪造固定位置我已经在这里利用底部固定位置标头的网站:http://www.entheospartners.com/newsite/在IE6

这种设置除了IE6,不支持在最不固定定位的所有浏览器的伟大工程,所以这里是什么我做:

当IE6用户来到页,我做出决定,如果滚动使用这段代码是必要的:

var windowHeight = $(window).height(); 
var totalHeight = windowHeight - 100; // where 100 is the sum of the top nav height + footer height 
var contentHeight; 

if($('#subpage-content-small').length) { // main content div for a three column layout 
    contentHeight = $('#subpage-content-small').height(); 
}; 

if($('#subpage-content-wide').length) { // main content div for a two column layout 
    contentHeight = $('#subpage-content-wide').height(); 
}; 

if(contentHeight > totalHeight) { 
    $('#container-container').css({ 
     'overflow-y' : "scroll", 
     'height' : totalHeight 
    }); 
}; 

...它正确地计算一切,把滚动条他们需要在哪里(正确地冲洗),并将它们设置到适当的高度。问题是滚动条不会移动内容。我不能说我以前见过这样的事情,所以我希望这里有其他人。提前致谢!

PS - 显然,这需要在IE6中查看故障排除,我知道这对你来说将会像对我一样痛苦。

UPDATE

后多一点挖CSS表达式的基础上,第一个答案,我来到了,对于固定的菜单定位到页面顶部有效的解决方案。我需要的只是能够使用它并将其应用到页面的底部。这并不像将所有“顶部”切换到“底部”那么简单,所以我希望有人能够启发我。这里的CSS:

#divfixed { 
    position: absolute; 
    top: expression(0+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+'px'); 
    left: expression(0+((e=document.documentElement.scrollLeft)?e:document.body.scrollLeft)+'px');} 

回答

0

基于CSS表达式的详细研究后,我碰到一个有用的jQuery插件,工作完美的我来了:http://chrisiona.com/fixedposition/

我使用条件为目标IE6和定位页脚栏绝对底部,然后应用fixedPosition插件,它的工作效果很好。我无法想象其他时候我会使用这个插件,但希望它能够帮助别人。

+0

这不适合我。 – 2012-09-12 19:09:20

1

你可以使用CSS表达式。下面的代码已从here复制。

fixme { 
    /* Netscape 4, IE 4.x-5.0/Win and other lesser browsers will use this */ 
    position: absolute; right: 20px; bottom: 10px; 
} 
body > div#fixme { 
    /* used by Opera 5+, Netscape6+/Mozilla, Konqueror, Safari, OmniWeb 4.5+, iCab,  ICEbrowser */ 
    position: fixed; 
} 
</style> 
<!--[if gte IE 5.5]> 
<![if lt IE 7]> 
<style type="text/css"> 
div#fixme { 
    /* IE5.5+/Win - this is more specific than the IE 5.0 version */ 
    right: auto; bottom: auto; 
    left: expression((-20 - fixme.offsetWidth + (document.documentElement.clientWidth ?  document.documentElement.clientWidth : document.body.clientWidth) + (ignoreMe2 =  document.documentElement.scrollLeft ? document.documentElement.scrollLeft :  document.body.scrollLeft)) + 'px'); 
    top: expression((-10 - fixme.offsetHeight + (document.documentElement.clientHeight  ? document.documentElement.clientHeight : document.body.clientHeight) + (ignoreMe =  document.documentElement.scrollTop ? document.documentElement.scrollTop :  document.body.scrollTop)) + 'px'); 
} 
</style> 
<![endif]> 
<![endif]-->