在IE6

2010-04-21 69 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]-->