Last active
August 29, 2015 14:05
-
-
Save pop/fce3c875c502ca1ebd1a to your computer and use it in GitHub Desktop.
A basic random gif displaying webpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<!-- Yes this file contains all of the JS, CSS, and HTML | |
I'm sure this personally offends you at a very very | |
deep level. If you would like to complain about this | |
please email support@comcast.net --> | |
<head> | |
<title> <gif> { Random } </gif> </title> | |
<style> | |
body { | |
background-color: #006666; | |
} | |
a { | |
color: #CCFFFF; | |
text-decoration: none; | |
font-family: 'Frutiger Neue W02 Book',Arial,sans-serif; | |
font-size: 20px; | |
} | |
a:hover { | |
text-decoration: none; | |
border-bottom:1px dotted; | |
} | |
</style> | |
</head> | |
<body> | |
<center> | |
<img id='gif'></img> | |
<p><a href="http://elijahcaine.github.io/"> http://elijahcaine.github.io/ </a></p> | |
</center> | |
<!-- This script is mostly just a series of Stack Overflow stuff. It works --> | |
<script> | |
var img = new Image(); | |
var div = document.getElementById('gif'); | |
img.onload = function() { | |
div.appendChild(img); | |
}; | |
// This is the list of images. Any foo.[imagetype] url works | |
var imgs = ['http://i.imgur.com/0MpYE.gif', | |
'http://i.imgur.com/lnhNk.gif', | |
'http://i.imgur.com/nMKvu.gif', | |
'http://i.imgur.com/qtGaq.gif', | |
'http://i.imgur.com/7eOFo.gif', | |
'http://i.imgur.com/zh2bH.gif', | |
'http://i.imgur.com/QbRqqf1.gif']; | |
// The 'random' number is achieved by the modulus of miliseconds since the epoch by the number of links in 'imgs' | |
var s = Date.now(); | |
s = s % imgs.length; | |
img.src = imgs[s]; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment