Skip to content

Instantly share code, notes, and snippets.

@PsHegger
Created January 23, 2015 09:07
Show Gist options
  • Save PsHegger/733c2c074e2401e4cb5f to your computer and use it in GitHub Desktop.
Save PsHegger/733c2c074e2401e4cb5f to your computer and use it in GitHub Desktop.
Flying eagle
function pinterIstvan() {
var sasDiv = document.getElementById("sasDiv");
if (!sasDiv) {
sasDiv = document.createElement("div");
sasDiv.setAttribute("id", "sasDiv");
sasDiv.style.position = "fixed";
sasDiv.style.zIndex = "99999999";
var sasImg = document.createElement("img");
sasImg.src = "https://i.imgur.com/cGCBuxM.gif";
sasDiv.appendChild(sasImg);
var sasCopyright = document.createElement("div");
sasCopyright.innerHTML = "Image by István Pintér";
sasCopyright.style.color = "transparent";
sasDiv.appendChild(sasCopyright);
var body = document.body;
body.insertBefore(sasDiv, body.childNodes[0]);
}
var lft = -sasDiv.offsetWidth;
var moveSas = function() {
lft += 5;
if (lft > document.body.clientWidth) lft = -sasDiv.offsetWidth;
sasDiv.style.left = lft + "px";
requestAnimationFrame(moveSas);
}
requestAnimationFrame(moveSas);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment