Carousel Vertical Slider with Vanilla Javascript

VanillaJS_DoubleVerticlSlider is a vertical / double-sliding carousel written in Vanilla JavaScript.

vertical split screen slider, split slider codepen, split image slider, image slider transition effects css, split slider jquery, split carousel

Tips and Tricks:

  • The slider is actually just a case shift feature that moves the left or right side up or down
  • There are two things that translate … have a left and right scroll bar. One is moving in the + Y direction, and the other is moving in the Y direction.

Example: slideRight.style.transform = translateY (- $ {activeSlideIndex * sliderHeight} px)

slideLeft.style.transform = translateY ($ {activeSlideIndex * sliderHeight} px) ∂

  • The reason the image stays in place is due to the slider-container {position: dynamic; Hide the excess; Width: 100vw; Height: 100 volts)
  • Removing the Convert feature will show the image instead of any transition For example: Move: Convert 3.5s easily inward.

How to make use of it:

1. Add left & right slides to the slider carousel.

<div class="slider-container">
  <div class="left-slide">
    <div style="background-color: #fd3555">
      <h1>Slide 1</h1>
      <p>This is slide 1</p>
    </div>
    <div style="background-color: #2a86ba">
      <h1>Slide 2</h1>
      <p>This is slide 2</p>
    </div>
    <div style="background-color: #252e33">
      <h1>Slide 3</h1>
      <p>This is slide 3</p>
    </div>
    <div style="background-color: #ffb866">
      <h1>Slide 4</h1>
      <p>This is slide 4</p>
    </div>
  </div>
  <div class="right-slide">
    <div style="background-image: url('1.jpg');"></div>
    <div style="background-image: url('2.jpg');"></div>
    <div style="background-image: url('3.jpg');"></div>
    <div style="background-image: url('4.jpg');"></div>
  </div>
  <div class="action-buttons">
    <button class="down-button">
      <i class="fas fa-arrow-down"></i>
    </button>
    <button class="up-button">
      <i class="fas fa-arrow-up"></i>
    </button>
  </div>
</div>

2. Required styles for the slider carousel.

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  height: 100vh;
}

.slider-container {
  position: relative;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.left-slide {
  height: 100%;
  width: 35%;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 3.5s ease-in-out;
}

.left-slide > div {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.left-slide h1 {
  font-size: 40px;
  margin-bottom: 10px;
  margin-top: -30px;
}

.right-slide {
  height: 100%;
  position: absolute;
  top: 0;
  left: 35%;
  width: 65%;
  transition: transform 0.5s ease-in-out;
}

.right-slide > div {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  height: 100%;
  width: 100%;
}

button {
  background-color: #fff;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 16px;
  padding: 15px;
}

button:hover {
  color: #222;
}

button:focus {
  outline: none;
}

.slider-container .action-buttons button {
  position: absolute;
  left: 35%;
  top: 50%;
  z-index: 100;
}

.slider-container .action-buttons .down-button {
  transform: translateX(-100%);
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.slider-container .action-buttons .up-button {
  transform: translateY(-100%);
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

3. The primary script to activate the slider carousel.

const sliderContainer = document.querySelector('.slider-container')
const slideRight = document.querySelector('.right-slide')
const slideLeft = document.querySelector('.left-slide')
const upButton = document.querySelector('.up-button')
const downButton = document.querySelector('.down-button')
const slidesLength = slideRight.querySelectorAll('div').length
let activeSlideIndex = 0
slideLeft.style.top = `-${(slidesLength - 1) * 100}vh`
upButton.addEventListener('click', () => changeSlide('up'))
downButton.addEventListener('click', () => changeSlide('down'))
const changeSlide = (direction) => {
  const sliderHeight = sliderContainer.clientHeight
  if (direction === 'up') {
    activeSlideIndex++
    if (activeSlideIndex > slidesLength - 1) {
      activeSlideIndex = 0
    }
  } else if (direction === 'down') {
    activeSlideIndex--
    if (activeSlideIndex < 0) {
      activeSlideIndex = slidesLength - 1
    }
  }
  slideRight.style.transform = `translateY(-${
    activeSlideIndex * sliderHeight
  }px)`
  slideLeft.style.transform = `translateY(${activeSlideIndex * sliderHeight}px)`
}

Vertical Split Slider Carousel, VanillaJS_DoubleVerticlSlider Plugin/Github, automatic image slider in html css javascript


See Demo And Download

Official Website(timManas): Click Here

This superior jQuery/javascript plugin is developed by timManas. For extra Advanced Usages, please go to the official website.

Related Posts

drag-drop-file-5x5-jq-uploader

Responsive Drag and Drop File Uploader/Download Plugin | 5x5_jq_uploader

5x5_jq_uploader plugin can be used to instantly create a drop file area and file queue with a little bit of preparation. Bootstrap is used for responsive planning…

Bootstrap-Dark-Mode

Stylesheet For Implementing Dark Mode with Bootstrap

Bootstrap Dark Mode provides a style sheet and two texts that allow you to implement Dark Mode on your website. Initially loaded based on user preferences, can…

responsive-navigation-menu

Multi-purpose Navigation Menu for Javascript Library | jQuery Corenav

coreNavigation is a multipurpose navigation menu for a jquery based javascript library, comes with more style, and is easy to integrate. 11 Default Menu 2 Responsive Navigation…

Simple-Multi-Select-Dropdown-Pure-Vanilla-Javascript

Simple Multi-Select Dropdown Pure Vanilla Javascript | multiSelect.js

MultiSelect.js is a simple, clean, and progressive JavaScript library designed for easy integration with any type of project or system. The design was heavily influenced by the…

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

how-to-create-popup-in-html-with-css

How To Create A Popup in HTML with CSS

How to create popup in html with css – Popup without JavaScript is an elegant pop-up panel component with an animated scale, written in CSS. Have you…