I'm currently trying to add a Konami Code which would spin a div on one of my (very simple) pages.
Here's my code:
<html>
<meta charset="UTF-8">
<script type="text/javascript" src="jquery.js"></script>
<html>
<script>
var k = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65],
n = 0;
$(document).keydown(function (e) {
if (e.keyCode === k[n++]) {
if (n === k.length) {
alert('Konami working');
return !1
}
} else k = 0
});
</script>
<style>
#div1
{
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
</style>
<div id="div1"><iframe frameborder="0" width="100%" height="100%" align="middle" src="//www.youtube.com/embed/_RJHLB3cBXU?autoplay=1&loop=1&controls=0&rel=0&showinfo=0&iv_load_policy=3&playlist=_RJHLB3cBXU"></iframe></div>
</html>
As you can see, it's just about triggering the animation specified in the messy CSS soup (which works perfectly), when the correct code is entered. I'm a bit desperate about it, would somebody have a idea ?
#div1.animate. And in the js, just have the success apply the class, like('#div1').addClass('animate');alert('Konami working');line work?