Creating absolute positioned div that becomes fixed on scroll - is it possible? - css

I had this idea for a website of creating a fixed horizontal navigation bar that simply scrolls through the content when you press the menu items but I wanted to have an "introduction" div on top of it with a background image and a logo, lets say of 300px height that displays when you first load the page.
So the navigation bar would appear attached to the bottom of this "introduction" div and only when you scrolled past it would it become attached to the top of the window and become fixed positioned when you scrolled.
If you clicked a certain menu item or if you simply scrolled up to the start of the page it would attach itself to the bottom of the "introduction" div again.
Is this possible to do simply with CSS or would I have to use javascript to achieve this effect?
Thanks in advance!

I think you'll need JavaScript for this one. It will not be hard however. The only thing you need to do is to switch the positioning of the menu to 'fixed' when the menu would otherwise scroll out of the viewport.

Related

Place items in center and lower right corner of a fullscreen flexbox?

On my site, I've created a flex box which fills the whole window. It has a width of 100% and a height of 100vh. I've placed a text and a button in the center of it. Now I want to add a footer to the page. If I place the footer under the div (flexbox) It'll only show up if I scroll down a little bit. So can I create another div inside the flexbox which will place it's items in the lower right corner of the page?
Without code it is hard to help but maybe try in the css float:right

CSS: How to fix one panel and scroll the other?

I have a web page with two panels. The left panel takes up the majority of of the width and displays user posts. The right panel is a navigation menu so I want it to remain fixed and never roll off the screen.
When there are too many posts to fit on one screen, a scroll bar appears on the right of the screen (NOT the panel), and the user scrolls down. This is all good, except that the navigation menu scrolls off the screen.
Both panels are within a common div. I tried setting its position to relative, then making the nav panel position fixed, with a right offset of 0. This kept the nav panel on the screen, but on the far right (ie. not within the containing div).
How do I go about keeping the nav panel fixed on the screen, but floated to the right of it's containing div?
Thanks a million!
EDIT: For and example of what I mean, look at Facebook. You'll see that the posts column can extend on forever, but the right hand column (with the advertisements) stays on the screen...
You could use the Twitter Bootstrap Affix JS plugin:
http://twitter.github.io/bootstrap/javascript.html#affix

Way to make content that scrolls under a navigation bar invisible but the bar have transparency

I have no idea how to go about this:
I have a full-screen background image, a navigation bar with 50% transparency fixed to the top, and content below it. How can I have the navigation bar maintain transparency over the background image, and still have scrolling content?
The issue right now is that when I scroll down, the content goes under the navigation bar, and shows through the transparency, which obviously looks awful.
Basically, I want the content of the page to scroll and disappear at the bottom of the navigation bar. I know I could make the navigation bar opaque and use a background image for that too, but I'd rather just have the one full-screen background image.
Thoughts?
Put the contents in a block (div) that has fixed size, say stretch it to the whole page except the size of the navigation bar. Then make that div scrollable with css property overflow:scroll
I know this is very old but I spent a lot of time looking for the answer and found a good solution so I will post it for anyone else looking for it.
Place the navbar in the element containing the background image and set the navbar's background to inherit. This prevents content from appearing behind the navbar as you scroll down.

scrolling to bottom of fixed positioned div

I have a fixed position side tab on my page that contains filtering options for the user. When there are a lot of options, the side tab gets too long and the bottom goes beyond the bottom of the page, where it is impossible to view.
Is there a way to have the whole page continue scrolling to the bottom of the side tab div? I don't want to put scroll bars inside my side tab div, even though that would be an easy fix. I just want, when the bottom of my div butts against the bottom of the page, to bring the whole div up with it so that the bottom content is visible.
I am limited in that I can't use jQuery in this particular application. I can, however, use Dojo.

Float aspx menu on center of screen during horizontal scroll

I have a static aspx menu. (horizontal)
I have content on the screen the sometimes requires horizontal scroll.
I would like to keep the menu the width of the visable screen and centered while scrolling. AKA. the menu would stay in the same position on the screen even when the user scrolls.
Is this possible?
Thanks in advance!
EDIT: I'm relaly looking for simple. Even something that would just keep the menu items aligned left would work for me. So the menu bar can go all the way accross, but the items in it would align left, so the right most part fo the menu bar would be empty on longer screens...
Try this one..it works well for me. It uses jquery & css. I put it on my masterpages.
http://net.tutsplus.com/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/
You can adjust the css to position it wherever you like

Resources