Skip to content

Instantly share code, notes, and snippets.

@private-face
Created March 26, 2012 19:25
Show Gist options
  • Save private-face/2208929 to your computer and use it in GitHub Desktop.
Save private-face/2208929 to your computer and use it in GitHub Desktop.
Screen defect
(function() {
div = document.createElement('div');
TOP = 250;
LEFT = 500;
div.style.backgroundColor = "#ff0000";
div.style.position = "fixed";
div.style.top = TOP + "px";
div.style.left = LEFT + "px";
div.style.width = "1px";
div.style.height = "1px";
function loop() {
var dx = (document.all) ? window.screenLeft : window.screenX,
dy = (document.all) ? window.screenTop : window.screenY;
div.style.top = TOP - dy + 'px';
div.style.left = LEFT - dx + 'px';
setTimeout(loop, 200);
};
document.body.appendChild(div);
setTimeout(loop, 0);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment