Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
<style>
</style>
  </head>
  <body>
<div id="fixed_div">I am fixed, even in IE6</div>
<p>Some stuff below the fixed DIV.</p>
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br />
<p>I am down here making the page have to scroll.</p>
    
  </div>
</body>
</html>
 
  #fixed_div {
    position: absolute;
    top: 0px; /* tweak this according to placement */
    left: 0px; /* tweak this according to placement */
    /* add additional styling, etc. */
    background-color: pink;
    bottom:0;
    right:0;
    opacity:0.5
  }
 
function move_box() {
    var offset = 0; // set offset (likely equal to your css top)
    var element = document.getElementById('fixed_div');
    element.style.top = (window.pageYOffset + offset) + 'px';
}
window.setInterval(move_box, 0);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers