Am curious to know how you create a frozen/non-scrolling regions on a webpage using javascript! like the one used by Stackoverflow when they alert you of the badge you have earned with a "X" close button!
Gath
From stackoverflow
-
You don't need to use javascript, you can do it with CSS just by setting the CSS property "display" to "fixed". You can of course do this with javascript if you like, like so:
var element = ...code to get the element you want...; element.style.display = 'fixed';
-
That's using CSS's position: fixed
body { margin-top: 20px; } #banner { position: fixed; height: 20px; }
John : This is not "position: static" -- "position: static" is the default positioning for most elements. This is "position: fixed".alex : Yes I know... my brain didn't work in my haste. I have ammended.
0 comments:
Post a Comment