How can I make a fixed navigation menu coexist with a scrollable blog?
-
In my design I have a scrollable navigation menu on the left, and the posts and sidebars next to it to the right. I set the position of the nav menu with top and left attributes with position: fixed. The rest is all inside another div with it top and left, but with position:absolute, this way it scrolls and the nav menu doesn't overlap with it. But if you make the window smaller and scroll right, it still does. Below there are two screenshot that shows it. How can I solve this? http://dl.dropbox.com/u/4628109/Files/Screen%20shot%202011-03-12%20at%205.22.21%20PM.png http://dl.dropbox.com/u/4628109/Files/Screen%20shot%202011-03-12%20at%205.22.47%20PM.png
-
Answer:
I think there are two results you'd want here: You want the nav menu to always be at the same position in the browser (that's what fixed means, after all), and so when the page width gets too narrow it'd float over the content; right now it floats, but transparency is mushing together the nav and the content. That's fixable w/ a background color and z-index, see: http://jsfiddle.net/ZmA7H/ You want the nav menu to follow the user when the user scrolls up and down the page, but not when the user scrolls left-right - as if you wanted x and y to be independent axes when applying the fixed positioning. As far as I know there isn't a way to do this with pure CSS, so you're stuck w/ a slightly laggy Javascript implementation: http://jsfiddle.net/x3hgA/ (for sites that do this, they make it easier on the eyes by smoothly animating the nav menu to its new top position).
Allen Cheung at Quora Visit the source
Other answers
Take a look at this GitHub repo https://github.com/DUNGCM/float-menu. No need extra JS code, just embed the CSS and JS file then add some css class to your html code.
Dzung Cao
Related Q & A:
- How can I make a myspace comment into a picture caption?Best solution by Yahoo! Answers
- How can I make a hole through a stone or crystal?Best solution by Yahoo! Answers
- How can I make a phone call to a cruise ship?Best solution by traveltips.usatoday.com
- How can i make a banner for a website?
- How can I make a good clay for a school project?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.