This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Position: fixed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Position: fixed" Watch "Position: fixed" New topic

Position: fixed

Ryan Schutte

Joined: Apr 26, 2009
Posts: 13
I am having trouble getting an image to go where I want it to. There is too much code to give it all to you, so I'll give you what I think is relevant. The page is at, click on Magazine Covers and move your mouse over the top magazine cover. Then, if you scroll all the way to the bottom, you'll see a larger image. I want it to be in the browser window and I thought fixed would do this. Here's what I have.

html at the bottom of the page

javascript - HideLarger will eventually be changed to none, I have it left in block so it stays and we can see what's happening. I have also tried inline instead of block

css - absolute would work perfect, if it would stay on the screen when you scroll... which is what I thought fixed was supposed to be, just like absolute except it doesn't scroll.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Helps to say what browser it fails in:

Ryan Schutte

Joined: Apr 26, 2009
Posts: 13
I'll figure out another way of doing it. I didn't think about mentioning the browser I'm using, but it is IE7 which looking back at the book I'm using, it says fixed should work on IE7, but that's the first IE that it should work on. There's too many browsers that it doesn't work on for me to use that technique, so instead of trying to figure out the problem with this - I'll figure out a new way of doing it.

Thanks for the help!
Ryan Schutte

Joined: Apr 26, 2009
Posts: 13
Here is the code that I ended up with.... works pretty well.

It is sorta covered in the JavaRanch Style Guide.
subject: Position: fixed
Similar Threads
reloading div dynamically
what to do, if I get error `breaking on JScript rumtime error - object expected
Absolute div dynamically appended to body element
my overlay box works in Firefox, but fails in IE8
Google's download window