Skip to content

Commit

Permalink
Удаляет лишние пробелы
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaFokina authored Jul 8, 2024
1 parent 82b356c commit b45d682
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions recipes/slider/demos/slider-demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ <h2 id="item-4-label">Паттерн «Алый»</h2>
const inactiveButton = 'aria-disabled'
const currentButton = 'aria-current'
let currentSlide = 0

function updateSlider() {
slides.forEach((slide, index) => {
slide.hidden = index !== currentSlide
})

controlButtons.forEach((button, index) => {
if (index === currentSlide) {
button.classList.add(activeButton)
Expand All @@ -212,12 +212,12 @@ <h2 id="item-4-label">Паттерн «Алый»</h2>
button.classList.remove(activeButton)
button.removeAttribute(currentButton, true)
}

prevButton.setAttribute(inactiveButton, currentSlide === 0)
nextButton.setAttribute(inactiveButton, currentSlide === slideCount - 1)
})
}

controlButtons.forEach((button, index) => {
button.addEventListener('click', () => {
if (index < slideCount) {
Expand All @@ -226,21 +226,21 @@ <h2 id="item-4-label">Паттерн «Алый»</h2>
}
})
})

prevButton.addEventListener('click', () => {
if (currentSlide > 0) {
currentSlide--
updateSlider()
}
})

nextButton.addEventListener('click', () => {
if (currentSlide < slideCount - 1) {
currentSlide++
updateSlider()
}
})

slider.addEventListener('keydown', function (event) {
if (event.key === 'ArrowLeft' && currentSlide > 0) {
currentSlide--
Expand All @@ -250,7 +250,7 @@ <h2 id="item-4-label">Паттерн «Алый»</h2>
updateSlider()
}
})

updateSlider()
})
</script>
Expand Down

0 comments on commit b45d682

Please sign in to comment.