Skip to content

Instantly share code, notes, and snippets.

@mr5z
Created September 6, 2017 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr5z/80072ce09b6e2c0def082e8cca5d2931 to your computer and use it in GitHub Desktop.
Save mr5z/80072ce09b6e2c0def082e8cca5d2931 to your computer and use it in GitHub Desktop.
lorem ipsum popups
function createPopup(e){var t=document.createElement("div");t.style.width="400px",t.style.height="180px",t.style.padding="40px 18px",t.style.backgroundColor="#555",t.style.color="white",t.style.position="absolute",t.style.left=rand(20,400)+(window.innerWidth/2-200)+"px",t.style.top=rand(20,200)+(window.innerHeight/2-90)+"px",t.style.zIndex="1000",t.style.transition="background-color 6s ease-out",t.className="x-popup";var o=document.createTextNode(e);return t.appendChild(o),t}function rand(e,t){return[-1,1][2*Math.random()|0]*Math.floor(Math.random()*(t-e+1)+e)}!function(){var e=0;setInterval(function(){e++;var t=createPopup("Lorem Ipsum");document.body.appendChild(t),setTimeout(function(){t.style.backgroundColor="rgba(0, 0, 0, 0)"},100),setTimeout(function(){document.body.removeChild(t)},6e3)},1e3)}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment