2017-05-04 36 views
-3

我有一個頁面在Rails中有4-5個選項卡。每個選項卡呈現一個部分(如一個頁面)。即使用戶向下滾動,我也希望能夠將屏幕上的標籤固定在頂部或頂部的某個邊緣。我使用Bootstrap的<ul class="nav nav-tabs">作爲標籤。如何在滾動時將助理中的導航標籤固定在頂部?

+0

http://stackoverflow.com/questions/23020763/what-does-navbar-static-top-do-in-bootstrap-3 – mxr7350

+0

我已經閱讀它,並嘗試。滾動內容與選項卡重疊。 –

回答

0
@media 
only screen and (your condition) 
{ 
[class*="nav-tabs"] 
    { 
    position: fixed; 
    z-index: 9; 
    background-color: #fff; 
    margin-top: -11%; // adjust according to your need 
    } 
    // you are probably gonna mess up tab-content margin as well, so adjust it as I have shown below 
    [class*="tab-content"] 
    { 
    margin-top: 5%; // insert n% as per your need 
    } 
} 
+0

好的..我會嘗試它並告訴你。 –

+0

當然,夥計!讓我知道它是否工作 – mehtasuraj09

+0

它的工作,我被卡住,因爲我是一個新手。謝啦 ! –

0

添加類navbar-fixed-top對資產淨值的UL

+0

嘿,它工作,導航欄的選項卡部分停留在頂部,但導航欄中的鏈接變爲非活動狀態,或者導航欄本身變爲非活動狀態。 –

+0

http://getbootstrap.com/components/#navbar – Kinga

+0

http://getbootstrap.com/javascript/#affix – Kinga

相關問題