Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="toggle-container">
  <div class="toggle-handle">
    <div class="crater crater-one"></div>
    <div class="crater crater-two"></div>
    <div class="crater crater-three"></div>
  <img class="mini-cloud" src="">
  <div class="star star-medium star-one"></div>
  <div class="star star-large star-two"></div>
  <div class="star star-small star-three"></div>
  <div class="star star-small star-four"></div>
  <div class="star star-medium star-five"></div>
  <div class="star star-large star-six"></div>
  <div class="star star-medium star-seven"></div>
              $height: 140px;
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
body {
  background: #222;
  transition: background .5s ease 0s;
.toggle-container {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: $height * 2;
  height: $height;
  background: #3C4145;
  border-radius: $height/2;
  border: ($height * .07143) solid #1C1C1C;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .5s ease 0s, background .5s ease 0s;
  .toggle-handle {
    position: absolute;
    height: $height * .7857;
    width: $height * .7857;
    left: $height * .042857;
    top: 0;
    bottom: 0;
    margin: auto;
    border-radius: 50%;
    background: #FFFFFF;
    border: ($height * .07143) solid #E4E9C8;
    box-shadow: 0px 0px 20px rgba(228, 233, 200, .5);
    z-index: 999;
    transition: left .5s ease 0s, background .5s ease 0s, border-color .5s ease 0s, transform .5s ease 0s;
    .crater {
      position: absolute;
      border: ($height * .07143) solid #E4E9C8;
      border-radius: 50%;
    .crater-one {
      top: 10%;
      left: 3%;
      height: 40%;
      width: 40%;
    .crater-two {
      right: 6%;
      top: 6%;
    .crater-three {
      right: 24%;
      bottom: 10%;
      height: 30%;
      width: 30%;
  .mini-cloud {
    height: 40%;
    width: auto;
    position: absolute;
    left: 20%;
    top: 38%;
    opacity: 0;
    z-index: 999;
    transition: opacity .25s ease 0s, left .5s ease 0s;
  .star {
    position: absolute;
    background: #FFFFFF;
    opacity: 1;
    border-radius: 50%;
    transform: scale(1);
    transition: transform .5s ease;
  .star-small {
    $smallStar: 4%;
    height: $smallStar;
    width: $smallStar/2;
  .star-medium {
    $mediumStar: 6%;
    height: $mediumStar;
    width: $mediumStar/2;
  .star-large {
    $largeStar: 8%;
    height: $largeStar;
    width: $largeStar/2;
  .star-one {
    top: 12%;
    left: 45%;
    transition-delay: .4s;
  .star-two {
    top: 72%;
    left: 50%;
    transition-delay: .35s;
  .star-three {
    top: 30%;
    left: 62%;
    transition-delay: .3s;
  .star-four {
    top: 56%;
    left: 68%;
    transition-delay: .25s;
  .star-five {
    top: 8%;
    left: 76%;
    transition-delay: .2s;
  .star-six {
    top: 40%;
    left: 86%;
    transition-delay: .15s;
  .star-seven {
    top: 70%;
    left: 82%;
    transition-delay: .1s;
.toggle-handle-day {
    left: ($height * 2) * .516 !important;
    background: #FFE06E !important;
    border-color: #E2C448 !important;
    transform: rotate(90deg);
.toggle-container-day {
    background: #9FE4FC;
    border-color: #86C4D8;
.off {
  background: #FAFAFA !important;
  transition: background .5s ease 0s;
.star-day {
  opacity: 0 !important;
  transform: scale(0) !important;
.crater-day {
  width: 0% !important;
  height: 0% !important;
  border: 0px solid transparent !important;
  transition: height .5s ease 0s, width .5s ease 0s, border .5s ease 0s;
.cloud-day {
  opacity: 1 !important;
  left: 40% !important;
              var darkSide = new Audio();
darkSide.src = "";

var lightSide = new Audio();
lightSide.src = "";

var clickCount = 0;

$('.toggle-container').on('click', function(){
  if (clickCount === 0){
    return darkSide.currentTime = 0;
  } else if (clickCount === 1){
    return lightSide.currentTime = 0;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.