Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

positioning depending upon scroll

Question posted by: hsriat (Expert) on May 13th, 2008 10:47 AM
I have a toolbox that appears dynamically on the screen.

Now what I want is, that this toolbox should have a top:120px and position:absolute.
But when page is scrolled up by more then 120px, its style should change to top:0px and position:fixed.

Here is an example of what I want. You can see show site navigation on top left of the page which have similar properties which I want.

It there any CSS way to do this?
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
harshmaul's Avatar
harshmaul
Expert
481 Posts
May 13th, 2008
03:51 PM
#2

Re: positioning depending upon scroll
hi hsriat,

Our paths aint crossed in a long time!! anyway... CSS HTML aint designed to do stuff like that. you need to use javascript to control where that sort of content goes.

You can only position images like that using background properties and such.

Reply
hsriat's Avatar
hsriat
Expert
1,427 Posts
May 13th, 2008
06:09 PM
#3

Re: positioning depending upon scroll
Quote:
Originally Posted by harshmaul
hi hsriat,

Our paths aint crossed in a long time!!

Hey Harjit,
I agree, but I've been regular here, not in this forum, but JavaScript and PHP.
Glad to know you remember :)

Quote:
Originally Posted by harshmaul
anyway... CSS HTML aint designed to do stuff like that. you need to use javascript to control where that sort of content goes.

Even I doubted, but just hoped may be there's some CSS positioning trick.
Like I kept on doing onmouseover="this.className='class2'" till one day I came to know there's something called :hover in CSS. :D

Anyhow, I'll try that out in JavaScript.

Regards,
Harpreet

Reply
harshmaul's Avatar
harshmaul
Expert
481 Posts
May 14th, 2008
10:18 AM
#4

Re: positioning depending upon scroll
good luck mate!!!!!!

Reply
Reply
Not the answer you were looking for? Post your question . . .
174,849 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top HTML / CSS Forum Contributors