MCPcopy Create free account
hub / github.com/codemistic/Web-Development / changeSlide

Function changeSlide

Double-vertical-slidebar/index.js:15–31  ·  view source on GitHub ↗
(direction)

Source from the content-addressed store, hash-verified

13downButton.addEventListener('click', () => changeSlide('down'))
14
15const changeSlide = (direction) => {
16 const sliderHeight = sliderContainer.clientHeight
17 if(direction === 'up') {
18 activeSlideIndex++
19 if(activeSlideIndex > slidesLength - 1) {
20 activeSlideIndex = 0
21 }
22 } else if(direction === 'down') {
23 activeSlideIndex--
24 if(activeSlideIndex < 0) {
25 activeSlideIndex = slidesLength - 1
26 }
27 }
28
29 slideRight.style.transform = `translateY(-${activeSlideIndex * sliderHeight}px)`
30 slideLeft.style.transform = `translateY(${activeSlideIndex * sliderHeight}px)`
31}

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected