This is a discussion on "Anyone up for a little challenge?" within the Web Page Design section. This forum, and the thread "Anyone up for a little challenge? are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Anyone up for a little challenge?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Hi, this is my first post so please be gentle.
I have a basic vertical menu halfway down the left hand side of a page, with a separate header section above it. As a user scrolls down the page, the menu of course automatically travels up the browser as usual along with everything else. But when it reaches the top of the browser, I want the menu to stay fixed there and not continue rising. Obviously, if I use {position:fixed} it just stays there in the middle all the time. Any ideas how I would be able to do this with CSS, or do I need some javascript? Thanks. |
|
|
|
#2
|
|||
|
|||
|
Re: Anyone up for a little challenge?
Try using this one. It's a neat and easily editable little floating menu script.
http://www.dynamicdrive.com/dynamici...staticmenu.htm Good luck! |
|
#3
|
|||
|
|||
|
Re: Anyone up for a little challenge?
Thanks RSoftware, not bad at all. However, in some respects, it's just a fancy version of a {position: fixed}. I'm looking for something a little more flexible, something that will let the menu travel up to the top of the browser as the user scrolls down the page, but then stay fixed once it reaches the top.
|
|
#4
|
||||
|
||||
|
Re: Anyone up for a little challenge?
position: fixed can do that. But you need to specify where you want the menu to sit.
For example
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
|
#5
|
|||
|
|||
|
Re: Anyone up for a little challenge?
Thanks aso186. Sorry to trouble you further, but could you put the whole example please. I'm just starting at CSS and, as my usernane suggests, I do need help!
Can you include the HTML just in case? Is this what you meant? body { position: relative; top: 3cm; } #selector { position: fixed; top: 200px; left: 60px; } Even when I change the body {top} to 5cm say, the #selector still stays in the same fixed position as it did when the body {top} was 2cm. What am I doing wrong? Thanks. |
|
#6
|
||||
|
||||
|
Re: Anyone up for a little challenge?
Np. You've pretty much got it! cm is not a valid measurement. Stick to %, em or px.
You don't need any styles for body. Just change the #selector values to re-position your element.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySpace.... Come say hello! (Will you take the challenge?) | Rob | Webforumz Cafe | 20 | Aug 6th, 2007 21:18 |
| Anyone up for a CSS challenge? | bob_visualefx | Web Page Design | 7 | Apr 7th, 2006 14:30 |
| iframe help, programmer's challenge | evilseth | Web Page Design | 2 | Jun 19th, 2005 20:13 |