JSFiddle - React, Tailwind, and code Playground

by kougiland

HTML

<h1>The Simplest Slider</h1>
<div class='images'>
  <div class='arrows'>
    <i class='prev icon-arrow-left4'></i>
    <i class='next icon-arrow-right4'></i>
  </div>
  <div class='image-container'>
    <img src='http://www.markmurray.co/images/catalpa.jpg'>
    <img src='http://www.markmurray.co/images/mcmahondental.jpg'>
    <img src='http://www.markmurray.co/images/mmlogo.jpg'>
    <img src='http://www.markmurray.co/images/jigsaw.jpg'>
    <img src='http://www.markmurray.co/images/skynetad.jpg'>
    <img src='http://www.markmurray.co/images/dfs.jpg'>
    <img src='http://www.markmurray.co/images/duc.jpg'>
  </div>
</div>

CSS

@import url(http://www.markmurray.co/codepen/entypostyle.css);
@import url(http://fonts.googleapis.com/css?family=Merriweather);
html, body {
  background: #2c3e50;
  font-family: Merriweather, sans-serif;
}

h1 {
  font-size: 3em;
  text-align: center;
  margin: 1em 0;
  color: white;
}

.images {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.images img {
  max-width: 100%;
  width: 33.48333%;
  height: auto;
  display: inline;
  margin: 0 -2px -3px;
  border: none;
  opacity: 0.2;
}
.images img:nth-child(2) {
  opacity: 1;
}
.images i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-size: 4em;
  z-index: 9;
}
.images i:hover {
  color: white;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}
.images i:nth-child(1) {
  left: 0.5em;
}
.images i:nth-child(2) {
  right: 0.5em;
}

JavaScript

var images = $('.image-container');

$('.prev').click(function(){
  $('.image-container img:last-child').prependTo(images);
});

$('.next').click(function(){
  $('.image-container img:first-child').appendTo(images);
});