YOU DIED js

by YH Park

HTML

Click me!!

CSS

body {
  background: rgb(200, 159, 35);
  color: rgb(230, 230, 230);
}

JavaScript

function YOU_DIED() {
  $('body').css('transition', 'opacity 2s ease 0s').css('opacity', '0').css('overflow', 'hidden');

  setTimeout(function() {
    $(document).focus();
    document.documentElement.requestFullscreen();
    $('html').css('overflow', 'hidden');
    $('body').empty();
    $('body').css('opacity', '1').css('transition', 'background 3s ease 0s').css('background', '#000');
    $('body').prepend('<h1 id="YOUDIED" style="position: fixed; margin: 43vh 0; width: 100vw; text-align: center; transition: opacity 4s ease-in 0s, font-size 6s ease 0s; opacity: 0; font-size: 6vw; color: #8e0c0c; font-family: serif; cursor: default; font-weight: bold;">YOU DIED</h1>');

    setTimeout(function() {
      new Audio('http://blog.park-yh.com/SRC/sound/Dark Souls Death.mp3').play();
      $('#YOUDIED').css('opacity', '1').css('font-size', '10vw');
    },3100);
  },2000);
}

$('html').click(function() {YOU_DIED();});