JSFiddle - React, Tailwind, and code Playground
by bizamajig
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.0.8/js/swiper.jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.0.8/js/swiper.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.0.8/css/swiper.min.css">
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script>
<!DOCTYPE html>
<body>
<!-- Swiper -->
<div class="swiper-container">
<div id='sortableList' class="swiper-wrapper">
<div class="swiper-slide bg-1">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-2">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-3">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-4">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-5">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-6">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-7">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-8">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-9">
<button class="swiper-no-swiping">btn</button>
</div>
<div class="swiper-slide bg-10">
<button class="swiper-no-swiping">btn</button>
</div>
</div>
...
CSS
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper-container {
width: 500px;
height: 300px;
margin: 20px auto;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
.card-placeholder {
background-color: black;
width: 20%;
height: 300px;
}
.bg-1 {
background-color: #511414;
}
.bg-2 {
background-color: #601F1F;
}
.bg-3 {
background-color: #702B2B;
}
.bg-4 {
background-color: #823B3B;
}
.bg-5 {
background-color: #914D4D;
}
.bg-6 {
background-color: #A35D5D;
}
.bg-7 {
background-color: #B27070;
}
.bg-8 {
background-color: #C18989;
}
.bg-9 {
background-color: #CEA1A1;
}
.bg-10 {
background-color: #DDB8B8;
}
.bg-11 {
background-color: #EFD7D7;
}
.left-top {
vertical-align: top;
text-align: left;
}
JavaScript
var mySwiper = new Swiper('.swiper-container', {
direction: 'horizontal',
//loop: true,
spaceBetween: 0,
slidesPerView: '5'
})
$('#sortableList').sortable({
//refreshPositions: true,
handle: 'button',
cancel: '',
//cursorAt: { left: 50 },
//distance: 5,
axis: "x",
//delay: 150,
//opacity: 0.6,
scroll: true,
//containment: 'parent',
placeholder: 'swiper-slide card-placeholder',
//tolerance: 'pointer'
}).disableSelection();