Wynn Netherland changelog.com/posts

fool.js: Punk your readers with CSS3 transforms

It’s either the funnest or most annoying day on the Interwebs, depending on your level of humor and caffeination. Tomás Senart, creator of Sight shared an easy way to punk your users on this special day with CSS3 Transformations:

<script>
//  Uncomment the next line if you want the prank to happen only when the url hashtag is #april
//  if (document.location.hash.indexOf('april') > -1)
  document.body.style.transform =
  document.body.style.webkitTransform =
  document.body.style.MozTransform =
  document.body.style.OTransform =
  document.body.style.msTransform =
  'rotate(' + [45, 90, 135, 180, 225, 270, 315][Math.floor(Math.random() * 7)] + 'deg)';
</script>

If you view our site and add #april to the URL hash, you’ll get a special randomly rotated topsy-turvy edition of The Changelog. Refresh as hilarity ensues. Enjoy!

[Source on GitHub]


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00