2012-10-08 13 views
-6

我需要幫助查找jQuery js修正左菜單like this根據瀏覽器標題修復了css菜單

固定位置滾動應取決於瀏覽器標題。

+3

你能解釋一下你需要一點點更清楚地描述你已經嘗試過的東西? –

+1

請讓我們知道您已經嘗試過,並且我們可以幫助您更好。 – karthikr

+1

只要看看他們的代碼。我在一分鐘之內發現它。 –

回答

2

看到link

的答案,我準備在回答一個演示可能它幫助你

你需要主要的是jQuery的

$(function(){ // this is the shorthand for document.ready 
    $(document).scroll(function(){ // this is the scroll event for the document 

    scrolltop = $(document).scrollTop(); // by this we get the value of the scrolltop ie how much scroll has been don by user 
    if(parseInt(scrolltop) >= 80) // check if the scroll value is equal to the top of navigation 
     { 
     $("#navbar").css({"position":"fixed","top":"0"}); // is yes then make the position fixed to top 0 
     } 
    else 
    { 
     $("#navbar").css({"position":"absolute","top":"80px"}); // if no then make the position to absolute and set it to 80 
    } 
    }) 

}); 
+0

還注意位置:對未來粘性。 http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit – urbananimal

+0

感謝兄弟這是我需要的:) –

+0

該腳本不爲我在IE中工作,任何解? –