Created
May 19, 2014 01:36
-
-
Save tmcw/4262f009d04ee997d01d to your computer and use it in GitHub Desktop.
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><head><title></title><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /><style type='text/css'> | |
body { | |
font-family: 'Helvetica'; | |
letter-spacing:-5px; | |
background:#000; | |
background-size:100%; | |
color:#fff; | |
margin:0; | |
padding:0; | |
font-weight:bold; | |
} | |
h1, h2, h3, p { | |
margin:0; | |
} | |
em, a { | |
font-style:normal; | |
color:#8dbd0c; | |
} | |
a { | |
background: #34d0e7; | |
color:#000; | |
text-decoration:none; | |
} | |
img { | |
width:100%; | |
} | |
div { | |
cursor:pointer; | |
cursor:hand; | |
position:absolute; | |
top:0px; | |
left:0px; | |
line-height:97%; | |
} | |
.bg-center { | |
background-position:center center; | |
background-size:contain; | |
background-repeat:no-repeat; | |
} | |
html { | |
height:100%; | |
} | |
.bg-center div { | |
height:100%; | |
} | |
</style><script type='text/javascript'> | |
window.onload = function() { | |
var s = document.getElementsByTagName('div'), cur = 0, ti; | |
if (!s) return; | |
function go(n) { | |
cur = n; | |
var i = 1e3, e = s[n], t; | |
// if the div has a bodyclass data attribute, add it to the body | |
document.body.className = e.dataset.bodyclass || ''; | |
for (var k = 0; k < s.length; k++) s[k].style.display = 'none'; | |
e.style.display = 'inline'; | |
e.style.fontSize = i + 'px'; | |
if (e.firstChild.nodeName === 'IMG') { | |
document.body.style.backgroundImage = 'url(' + e.firstChild.src + ')'; | |
e.firstChild.style.display = 'none'; | |
if ('classList' in e) e.classList.add('imageText'); | |
} else { | |
document.body.style.backgroundImage = ''; | |
document.body.style.backgroundColor = e.style.backgroundColor; | |
} | |
if (ti !== undefined) window.clearInterval(ti); | |
t = parseInt(e.dataset.timeToNext || 0, 10); | |
if (t > 0) ti = window.setTimeout(fwd, (t * 1000)); | |
while ( | |
e.offsetWidth > window.innerWidth || | |
e.offsetHeight > window.innerHeight) { | |
e.style.fontSize = (i -= 2) + 'px'; | |
if (i < 0) break; | |
} | |
e.style.marginTop = ((window.innerHeight - e.offsetHeight) / 2) + 'px'; | |
if (window.location.hash !== n) window.location.hash = n; | |
document.title = e.textContent || e.innerText; | |
} | |
document.onclick = function() { go(++cur % (s.length)); }; | |
function fwd() { go(Math.min(s.length - 1, ++cur)); } | |
function rev() { go(Math.max(0, --cur)); } | |
document.onkeydown = function(e) { | |
if (e.which === 39) fwd(); | |
if (e.which === 37) rev(); | |
}; | |
document.ontouchstart = function(e) { | |
var x0 = e.changedTouches[0].pageX; | |
document.ontouchend = function(e) { | |
var x1 = e.changedTouches[0].pageX; | |
if (x1 - x0 < 0) fwd(); | |
if (x1 - x0 > 0) rev(); | |
}; | |
}; | |
function parse_hash() { | |
return Math.max(Math.min( | |
s.length - 1, | |
parseInt(window.location.hash.substring(1), 10)), 0); | |
} | |
if (window.location.hash) cur = parse_hash() || cur; | |
window.onhashchange = function() { | |
var c = parse_hash(); | |
if (c !== cur) go(c); | |
}; | |
go(cur); | |
}; | |
</script></head><body> | |
<div>welcome to <em>Big</em></div> | |
<div data-bodyclass='bg-center'><img src='http://www.fertomniavirtus.com/wp-content/uploads/24.-Bauhaus.-Wassily-Kandinsky.-Barbican.jpg' /></div> | |
<div> and also</div> | |
<div>and also <img src='http://www.w3schools.com/images/w3logotest2.png' /></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment