JSFiddle - React, Tailwind, and code Playground
by Artem Shelengovskiy
HTML
<div class="submenu_slider">
<div class="left_button"></div>
<div class="slider_ulwrap">
<ul class="slider_ul">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="right_button"></div>
</div>
CSS
.submenu_slider {
position: absolute;
top: 15px;
left: 28%;
bottom: 15px;
z-index: 1;
list-style: none;
text-align: center;
font: 12px Arial, Helvetica, sans-serif;
text-transform: uppercase;
/*background-color: green;*/
width: 900px;
height: 290px;
float: left;
text-align: left;
/*display: none;*/
overflow: hidden;
}
.slider_ulwrap {
/*z-index: 0;*/
position: absolute;
height: 290px;
/*margin: 0;
padding: 0;*/
/*list-style: none;*/
/*display: block;*/
/*background-color: red;*/
}
.slider_ul {
padding: 0;
}
.slider_ul li {
position: relative;
display: block;
float: left;
margin: 10px 5px;
width: 215px;
height: 270px;
background-color: grey;
overflow: hidden;
}
.left_button {
position: absolute;
height: 20%;
width: 5%;
top: 40%;
left: 0;
background-color: #D7D7D7;
z-index: 1;
}
.right_button {
position: absolute;
height: 20%;
width: 5%;
top: 40%;
left: 95.4%;
background-color: #D7D7D7;
z-index: 1;
}
JavaScript
$(".submenu_slider").on("click", ".right_button", function () {
$(this).animate({
left: "-=225px"
}, 200);
});
$(".submenu_slider").on("click", ".left_button", function () {
$(this).animate({
left: "+=225px"
}, 200);
});