Anyone up for a little challenge?

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 6th, 2008, 08:22
New Member
Join Date: Mar 2008
Location: Liverpool
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Anyone up for a little challenge?

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 6th, 2008, 08:38
Junior Member
Join Date: Mar 2008
Location: Torquay, Devon, UK
Age: 24
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 6th, 2008, 09:07
New Member
Join Date: Mar 2008
Location: Liverpool
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 6th, 2008, 12:13
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
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
Code: Select all
#selector {
position: fixed;
top: 20px;
left: 60px
}
This will put the #selector 20px from the top and 60px from the left of the visible screen, relative to the containing element with position: relative (body by default).
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 6th, 2008, 14:23
New Member
Join Date: Mar 2008
Location: Liverpool
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 6th, 2008, 15:11
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
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.

Code: Select all
* { /* Resets browser defaults for consistency */
margin: 0;
padding: 0;
border: 0
}

#selector {
position: fixed;
top: 200px; /* Change this value for how far from the top you want it */
left: 60px; /* Change this value for how far from the left you want it */
}
Then in your html, you would set the id of the element you wish to position using
Code: Select all
id="selector"
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 03:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42