I got a div, I’d like some code to be executed onClick, that’d move the div to the top of the viewport (not to the top of the page), kinda like a “vertical float”.
Is there a way to do this? I’ve seen annoying menus/ advertisements that stick to the top of the window even if you scroll down.
If you apply a css style of ‘position:fixed;top:0’ you will only annoy visitors who have firefox, opera, safari and IE7.
If you want to annoy everyone, get the document.body.scrollTop or document.documentElement.scrollTop or the window.pageYoffset to calculate the amount the page has scrolled and position your element top to that amount of pixels.
Ah - yes I admit that many people did not like the “floater” style menus - even tho they are fun to create
nicc9, for examples of “floater” menus (and how to position an element relative to the ‘viewport’) go to my Toys page and search for “floater”. For examples of “fixed” elements go to my Toys page and search for “fixed”.