私は学校のプロジェクトのために作っているウェブサイトのどこかに小さな隠されたボタンを置こうとしています。私はそのページを絶対に狂わせるようにします。私はすでにそれが狂ったようにするためのコードを持って、私はちょうど私がボタンに "バインド"する方法を知っていない。または、コナミコード、それも動作します。Css onclickイースターエッグ
CSS
body, p, h1, div {
width: 100px;
height: 100px;
background-color: red;
position: relative;
/* Chrome, Safari, Opera */
-webkit-animation-name: example;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-delay: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
/* Standard syntax */
animation-name: example;
animation-duration: 1s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes example {
0% {background-color:red; left:20%; top:20%; -webkit-transform: rotateX(180deg) rotateZ(-90deg) rotateY(360deg);}
25% {background-color:yellow; left:80%; top:20%;-webkit-transform: rotateX(0deg) rotateZ(90deg) rotateY(0deg);}
50% {background-color:blue; left:80%; top:80%;-webkit-transform: rotateX(180deg) rotateZ(-90deg) rotateY(0deg);}
75% {background-color:green; left:20%; top:80%;-webkit-transform: rotateX(0deg) rotateZ(90deg) rotateY(0deg);}
100% {background-color:red; left:20%; top:20%;-webkit-transform: rotateX(180deg) rotateZ(-90deg) rotateY(0deg);}
}
/* Standard syntax */
@keyframes example {
0% {background-color:red; left:20%; top:20%;transform: rotateX(180deg) rotateZ(-90deg) rotateY(360deg);}
25% {background-color:yellow; left:80%; top:20%;transform: rotateX(0deg) rotateZ(90deg) rotateY(0deg);}
50% {background-color:blue; left:80%; top:80%;transform: rotateX(180deg) rotateZ(-90deg) rotateY(360deg);}
75% {background-color:green; left:20%; top:80%;transform: rotateX(0deg) rotateZ(90deg) rotateY(0deg);}
100% {background-color:red; left:20%; top:20%;transform: rotateX(180deg) rotateZ-(-90deg) rotateY(360deg);}
私はこれに本当に貢献しているとは思えませんが、ボタンの代わりにコナミコードはどうですか? http://code.snaptortoise.com/konami-js/ –
@BenHarrisonそれはまた、試してみるのはかなり楽しいと聞こえるが、私はまだそれを黙示する方法については全く考えていないだろう。 –
外部CSSを動的に読み込んだり、セレクタの前にクラス名(例: 'body.egg')を付けて、そのクラスを追加することができます。いずれの場合も、JavaScriptが必要になる可能性があります。 –