Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <ul class="slider">
  <li>
    <input type="radio" id="slide1" class="radio" name="slide" checked> <label for="slide1"></label>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1689631/love-unite.jpg">
  </li>

  <li>
    <input type="radio" id="slide2" class="radio" name="slide">
    <label for="slide2"></label>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1689631/sunshine.jpg">
  </li>

  <li>
    <input type="radio" id="slide3" class="radio" name="slide">
    <label for="slide3"></label>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1689631/ta-smoke.jpg">
  </li>

  <li>
    <input type="radio" id="slide4" class="radio" name="slide">
    <label for="slide4"></label>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1689631/trees-tifo.jpg">
  </li>

  <div class="left-trigger" id="left">
    <div class="left-top"></div>
    <div class="left-bottom"></div>
  </div>
  <div class="right-trigger" id="right">
    <div class="right-top"></div>
    <div class="right-bottom"></div>
  </div>
</ul>
              
            
!

CSS

              
                body {
  width: 100vw;
  height: 100vh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  background: white;
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"%3E%3Cg fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.4"%3E%3Cpath opacity=".5" d="M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z"/%3E%3Cpath d="M6 5V0H5v5H0v1h5v94h1V6h94V5H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}
.slider {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  height: 15em;
  width: 25em;
}

.slider li {
  list-style: none;
  position: absolute;
}

.slider img {
  transition: 0.15s ease;
  height: 15em;
  width: 25em;
  vertical-align: top;
}

.slider input {
  display: none;
}

.slider label {
  background-color: #fff;
  bottom: 5px;
  cursor: pointer;
  display: block;
  height: 10px;
  position: absolute;
  width: 10px;
  z-index: 10;
  border-radius: 50%;
}

.slider li:nth-child(1) label {
  left: 9.5em;
}
.slider li:nth-child(2) label {
  left: 11em;
}
.slider li:nth-child(3) label {
  left: 12.5em;
}
.slider li:nth-child(4) label {
  left: 14em;
}
.slider img {
  opacity: 0;
  visibility: hidden;
}
.slider li input:checked ~ img {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

.slider li input:checked ~ label {
  background-color: black;
  border: solid 2px white;
  -webkit-transition: 0.15s ease;
  -o-transition: 0.15s ease;
  transition: 0.15s ease;
}
.left-trigger {
  position: relative;
  left: -35px;
  width: 50px;
  height: 50px;
  background-color: green;
  border-radius: 5px;
  z-index: 12;
}

.right-trigger {
  position: relative;
  right: -35px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: space-evenly;
  -ms-flex-pack: space-evenly;
  justify-content: space-evenly;
  width: 25px;
  height: 40px;
  background-color: green;
  z-index: 12;
  border-radius: 5px;
}
.right-trigger:hover {
  cursor: pointer;
}
.right-top {
  height: 5px;
  background-color: white;
  border-radius: 5px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.right-bottom {
  height: 5px;
  background-color: white;
  border-radius: 5px;
  -webkit-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

.left-trigger {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: space-evenly;
  -ms-flex-pack: space-evenly;
  justify-content: space-evenly;
  width: 25px;
  height: 40px;
  background-color: green;
  border-radius: 5px;
}
.left-trigger:hover {
  cursor: pointer;
}
.left-top {
  height: 5px;
  background-color: white;
  border-radius: 5px;
  -webkit-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

.left-bottom {
  height: 5px;
  background-color: white;
  border-radius: 5px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

              
            
!

JS

              
                //right arrow
const right = document.getElementById("right");
//left arrow
const left = document.getElementById("left");

//radio buttons
const slide1 = document.getElementById("slide1");
const slide2 = document.getElementById("slide2");
const slide3 = document.getElementById("slide3");
const slide4 = document.getElementById("slide4");

//array of radio buttons
let radio_array = new Array(slide1, slide2, slide3, slide4);

//length of radio buttons array
let radio_length = radio_array.length;

//placemarker
let i = 0;

//when you click on a radio button set placemarker to that point
radio_array.forEach(
  (item, index) =>
    (item.onclick = () => {
      i = index;
      //console.log("index #" + (i + 1));
    })
);

right.onclick = () => {
  //button animation on click
  anime({
    targets: ".right-trigger",
    keyframes: [{ scale: 1.15 }, { scale: 1 }],
    easing: "easeOutElastic(1, .8)",
    duration: 250
  });
  //increment placemarker
  i++;

  //if placemarker is greater than the length of array go back to start '-1 accounts for the array starting at zero'
  if (i > radio_length - 1) {
    i = 0;
  }
  radio_array[i].checked = true;
  //console.log("index #" + (i + 1));
};

left.onclick = () => {
  anime({
    targets: ".left-trigger",
    keyframes: [{ scale: 1.15 }, { scale: 1 }],
    easing: "easeOutElastic(1, .8)",
    duration: 250
  });
  i--;
  if (i < 0) {
    i = radio_length - 1;
  }
  radio_array[i].checked = true;
  //console.log("index #" + (i + 1));
};

              
            
!
999px

Console