JSFiddle - React, Tailwind, and code Playground

by Taleeb Anwar

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<button id="_uploadImages" class="btn btn-primary">Upload Images</button>
<form id="_imagesForm" action="" method="post">
    <input id="_imagesInput" type="file" style="display:none" multiple>
</form>
<div id="_displayImages">
    <div class="slider">
        <ul id="frames" class="frames"></ul>
        <div class="nav-dots">
            
        </div>
    </div>
</div>

CSS

* {
    margin: 0;
    padding: 0;
    /*transition*/
    -webkit-transition: all 1s ease;
    -moz-transition: all 1s ease;
    -o-transition: all 1s ease;
    transition: all 1s ease;
}
body {
    padding:30px;
}
/* Slider */
 .slider {
    height: 250px;
    left: 50%;
    margin: -125px -225px;
    position: absolute;
    top: 48%;
    width: 450px;
    /*box-shadow*/
    -webkit-box-shadow: 0 0 5px #000;
    -moz-box-shadow: 0 0 5px #000;
    box-shadow: 0 0 5px #000;
}
.slider .frames {
    height: 250px;
    position: relative;
    list-style-type: none;
}
.slider .frames .slide {
    height: 250px;
    list-style: none;
    position: absolute;
    width: 450px;
}
.slider .slide:target {
    z-index: 100
}
.slider .frames .slide img {
    height: 250px;
    width: 450px;
}
.slider .frames .slide nav a {
    background: hsla(0, 0%, 0%, .75);
    color: #fff;
    font-size: 16px;
    line-height: 50px;
    margin-top: -25px;
    opacity: 0;
    position: absolute;
    text-align: center;
    text-decoration: none;
    top: 50%;
    width: 50px;
    visibility: hidden;
    z-index: 10;
}
.slider:hover .frames .slide nav a {
    opacity: 1;
    visibility: visible;
}
.slider .frames .slide nav .prev {
    /*border-radius*/
    -webkit-border-radius: 0 25px 25px 0;
    -moz-border-radius: 0 25px 25px 0;
    border-radius: 0 25px 25px 0;
    left: 0;
}
.slider .frames .slide nav .next {
    /*border-radius*/
    -webkit-border-radius: 25px 0 0 25px;
    -moz-border-radius: 25px 0 0 25px;
    border-radius: 25px 0 0 25px;
    right: 0;
}
.slider .frames .slide nav a:hover {
    background: #000
}
.slider .quicknav {
    bottom: 0;
    font-size: 0;
    opacity: 0;
    position: absolute;
    text-align: center;
    width: 100%;
    z-index: 100;
}
.slider:hover .quicknav {
    opacity: .9
}
.slider .quicknav li {
    display: inline-block
}
.slider .quicknav a {
    background: hsla(0, 0%, 100%, .9);
    border: 1px solid hsla(0, 0%, 0%, .9);
   ...

JavaScript

$('#_uploadImages').click(function () {
    $('#_imagesInput').click();
});

$('#_imagesInput').on('change', function () {
    handleFileSelect();
});

function handleFileSelect() {
    //Check File API support
    if (window.File && window.FileList && window.FileReader) {

        var files = event.target.files; //FileList object
        var output = document.getElementById("frames");
        var dots = $('.nav-dots');
        var arrFilesCount = [];
        var start = $(output).find('li').length;
        var end = start+ files.length;
        var nonImgCount = 0;
        for (var i = start; i < end; i++) {
            arrFilesCount.push(i);
        }
        
        if(start !== 0){
            $(output).find('li > nav > a.prev').first().attr('href','#slide-' + (end-1));
            $(output).find('li > nav > a.next').last().attr('href','#slide-'+start);
        }
        
        for (var i = 0; i < files.length; i++) {

            var file = files[i];

            //Only pics
            if (!file.type.match('image')) {nonImgCount++; continue;}

            var picReader = new FileReader();
            picReader.addEventListener("load", function (event) {
                var picFile = event.target;

                current_i = arrFilesCount.shift();
                if (current_i === 0) {
                    prev_i = files.length - 1;
                } else {
                    prev_i = current_i - 1;
                }
                if (arrFilesCount.length - nonImgCount === 0) {
                    next_i = 0;
                } else {
                    next_i = current_i + 1;
                }

                output.innerHTML = output.innerHTML + '<li id="slide-' + current_i + '" class="slide">' + "<img src='" + picFile.result + "'" + "title=''/>" + '<nav>' + '<a class="prev" href="#slide-' + prev_i + '">&larr;</a>' + '<a class="next" href="#slide-' + next_i + '">&rarr;</a>' + '</nav>' + '</li>'; // TODO: Enter Title
                
               ...