Skip to content

Instantly share code, notes, and snippets.

@scottsappen
Created July 1, 2013 14:50
Show Gist options
  • Save scottsappen/5901507 to your computer and use it in GitHub Desktop.
Save scottsappen/5901507 to your computer and use it in GitHub Desktop.
Fixed in place, but moves! Many people think that in order to create something on a page that stays in place (and appears to move) that you actually have to move it. I know that sounds weird, but you wouldn’t believe how many people think you need to use something like jquery. You know, $(“#mydiv”) x and y coordinates, screen top etc…ah, not so,…
//and here it is, moving with your mouse
<div style="position:fixed;">Move me around</div>
It doesn’t need to be much more complicated than that, unless you want to work with non-CSS compliant issues or have concerns about scrolling past other divs etc. But for something simple, this works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment