css - Twitter Bootstrap Navigation Bar Fixed -
what must change make navigation bar fixed when screen size under 940px? don't want make responsive. if resize browser windows under 940px see scroolbar-x (bottom-scrollbar) appear, when scroll right, navigation bar position still fixed, , menu won't appear.


maybe picture explain problem.
this can't done in css alone.
the example give (twitter) has navbar fixed position , fixed size @ screen sizes. fixed position means scrollbars not affect position of navbar, , why can't use x-scrollbar see part of navbar which, once it's less 940px wide, hidden 'under' right border of browser window.
so have choose, either
- have fixed position, fixed size navbar present @ top no matter how far user scrolls down , accept under small enough screen won't able scroll horizontally see all, or
- have fixed position, fluid size navbar adjusts width accommodate different screen sizes, mitigate need scroll horizontally in first place, if let grow vertically if contents don't fit in 1 row, or
- have non-fixed position, fixed size navbar respond horizontal scrolling not ever-present when user scrolls down page.
effectively, can't have position work 1 way in x direction , in y.
you can see mean option 2 editing following classes in twitter page using css inspector:
.global-nav .container { width: auto; max-width: 865px; } .global-nav, .global-nav-outer { height: auto; } the second selector implements vertical fluidity once contents can't fit in 1 row.
you can see mean option 3 making these changes:
.topbar { position: absolute; /* ... rest */ } edit
of course, can't done in css doesn't mean can't done @ all. here's jsfiddle implementing script mentioned. uses mootools opposed jquery, use bootstrap.
the fiddle: http://jsfiddle.net/uaddw/4/
full screen version better see effect: http://jsfiddle.net/uaddw/4/show/
(thanks @sherbrow providing base fiddle made one).
Comments
Post a Comment