Snippet: Change background color after scrolling on page!

A simple snippet I created to help out a Twitterer where the background color changes as you scroll down on the page:

  <title>Change Color on Scroll</title>

    body {
      background-color: yellow;
      transition: all 1s ease-in;
    div {
      min-height: 2000px;
    .color {
      background-color: red;




    window.addEventListener("scroll", scrolling, false);

    function scrolling(e) {
      // change background color after scrolling 500 pixels
      if (window.pageYOffset > 500) {
      } else {

Kirupa :stuck_out_tongue: