-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (19 loc) · 779 Bytes
/
script.js
File metadata and controls
21 lines (19 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.addEventListener('DOMContentLoaded', function () {
const leftArrow = document.getElementById('left');
const rightArrow = document.getElementById('right');
const carousel = document.querySelector('.carousel');
// Function to handle clicking on the right arrow
rightArrow.addEventListener('click', function () {
carousel.scrollBy({
left: 250, // Adjust this value as needed for desired scroll distance
behavior: 'smooth'
});
});
// Function to handle clicking on the left arrow
leftArrow.addEventListener('click', function () {
carousel.scrollBy({
left: -250, // Adjust this value as needed for desired scroll distance
behavior: 'smooth'
});
});
});