JSFiddle - React, Tailwind, and code Playground
by Alexandru Gatea
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<div class="articles">
<div class="article-carousels">
<div class="article-image-carousel slider-for">
<div><img src="https://loremflickr.com/350/600" alt=""></div>
<div><img src="https://loremflickr.com/350/600" alt=""></div>
<div><img src="https://loremflickr.com/350/600" alt=""></div>
</div>
<div class="article-text-carousel">
<div class="slider-nav">
<div>Text for receipe 1</div>
<div>Text for receipe 2</div>
<div>Text for receipe 3</div>
</div>
</div>
<div class="carousel-nav">
<div class="previous">
<span class="arr">
<img src="https://img.icons8.com/ios/60/ffffff/long-arrow-up.png">
</span>
<span>Prev recipe</span>
</div>
<div class="next">
<span>Next recipe</span>
<span class="arr">
<img src="https://img.icons8.com/ios/60/ffffff/long-arrow-down.png">
</span>
</div>
</div>
</div>
</div>
SCSS
@import url('https://fonts.googleapis.com/css?family=Noto+Serif:400,700');
$yellow: #EFB32E;
$blue: #3E4F5F;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Noto Serif", serif;
}
.articles {
background: $yellow;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
position: relative;
&:before {
content: '';
width: 20%;
height: 100%;
position: absolute;
top: 0;
right: 0;
background: $blue;
}
.article-carousels {
height: 600px;
width: 80%;
background: #ffffff;
box-shadow: 10px 10px 60px 0px rgba(0, 0, 0, 0.5);
position: relative;
z-index: 1;
display: grid;
grid-template-columns: 300px auto 80px;
grid-template-rows: auto;
}
}
.carousel-nav {
position: relative;
height: 100%;
.previous,
.next {
height: 300px;
color: #ffffff;
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
padding: 20px 0;
cursor: pointer;
transition: all 0.3s ease;
span {
font-size: 10px;
}
}
.next {
background: $blue;
&:hover {
background: darken($blue, 10%);
}
}
.previous {
background: $yellow;
&:hover {
background: darken($yellow, 10%);
}
}
}
.article-image-carousel {
background: $blue;
position: relative;
height: 600px;
}
.slider-nav {
width: 100%;
* {
width: 100%;
}
.slick-slide {
height: 600px;
background: #fff;
padding: 30px;
}
}
.slick-dots {
position: absolute;
display: flex;
flex-direction: column;
bottom: 30px;
left: 10px;
width: 30px;
li {
width: 60px;
height: 30px;
button {
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
width: 60px;
height: 30px;
padding: 5px;
cursor: pointer;
color: #ffffff;
border: 0;
outline: 0;
...
JavaScript
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
dots: true,
fade: true,
asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
slidesToShow: 1,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
focusOnSelect: true,
vertical:true,
nextArrow: $('.next'),
prevArrow: $('.previous')
});