<div class="slider">
<div class="leftArrow"></div>
<div class="about_items">
<div class="about_items-item">
<div class="item_rigth">
<p class="about_item-name">July 2010</p>
<p class="about_item-name">Our Humble Beginnings</p>
<p class="item-message_right item_message">Proin iaculis purus consequat sem cure
digni ssim. Donec porttitora entum suscipit
aenean rhoncus posuere odio in tincidunt. Proin
iaculis purus consequat sem cure digni
ssim. Donec porttitora entum suscipit.</p>
</div>
<div>
<img src="img/about1.png">
</div>
</div>
<div class="about_items-item">
<div>
<img src="img/about2.png">
</div>
<div class="item_left">
<p class="about_item-name">January 2011</p>
<p class="about_item-name">Facing Startup Battles</p>
<p class="item-message_left item_message">Proin iaculis purus consequat sem cure
digni ssim. Donec porttitora entum suscipit
aenean rhoncus posuere odio in tincidunt. Proin
iaculis purus consequat sem cure digni
ssim. Donec porttitora entum suscipit aenean
rhoncus posuere odio in tincidunt.</p>
</div>
</div>
<div class="about_items-item">
<div class="item_rigth">
<p class="about_item-name">December 2012</p>
<p class="about_item-name">Enter The Dark Days</p>
<p class="item-message_right item_message">Proin iaculis purus consequat sem cure
digni ssim. Donec porttitora entum suscipit
aenean rhoncus posuere odio in tincidunt. Proin
iaculis purus consequat sem cure digni.</p>
</div>
<div>
<img src="img/about3.png">
</div>
</div>
<div class="about_items-item">
<div>
<img src="img/about4.png">
</div>
<div class="item_left">
<p class="about_item-name">February 2014</p>
<p class="about_item-name">Our Triumph</p>
<p class="item-message_left item_message">Proin iaculis purus consequat sem cure
digni ssim. Donec porttitora entum suscipit
aenean rhoncus posuere odio in tincidunt. Proin
iaculis purus consequat sem cure digni
ssim. Donec porttitora entum suscipit aenean.</p>
</div>
</div>
</div>
<div class="rightArrow"></div>
</div>
// Slider
let slide = document.getElementsByClassName('about_items-item');
let dot = document.getElementsByClassName('dot');
let dots = document.getElementsByClassName('dots')[0];
let left = document.getElementsByClassName('leftArrow')[0];
let right = document.getElementsByClassName('rightArrow')[0];
let currentSlide = 0;
//Отображаем текущий слайд
showSlides(currentSlide)
function showSlides(currentSlide){
for(let i = 0; i < slide.length; i++){
slide[i].style.display = 'flex';
dot[i].style.backgroundColor = 'grey';
if(i != currentSlide){
slide[i].style.display = 'none';
dot[i].style.backgroundColor = '#dfe1e2';
}
}
}
//Переключение по таймингу
function incrementSlide(){
currentSlide++;
if (currentSlide >= slide.length) {
currentSlide = 0;
}
showSlides(currentSlide);
}
showSlides(currentSlide)
setInterval(incrementSlide, 5000);
//Переключение слайда влево
left.addEventListener('click', function() {
currentSlide--;
if(currentSlide <=0){
currentSlide = 3;
}
showSlides(currentSlide);
});
//Переключение слайда вправо
right.addEventListener('click', incrementSlide);
.rightArrow, .leftArrow{
background-image: url(../img/arrow-point-to-right.png);
width: 50px;
height: 100px;
margin-top: 70px;
background-repeat: no-repeat;
background-position: center center;
}
.leftArrow{
background-image: url(../img/left-arrow.png);
}
.leftArrow:hover{
opacity: 1;
background-image: url(../img/left-arrowHover.png);
background-color: grey;
}
.rightArrow:hover{
opacity: 1;
background-color: grey;
background-image: url(../img/arrow-rightHover.png);
}
.slider{
display: flex;
justify-content: center;
}
.about_items{
max-width: 40%;
width: 40%;
min-height: 310px;
overflow: hidden;
}
.about_items-item{
display: flex;
justify-content: space-around;
}