Skip to content

Commit

Permalink
swiper js
Browse files Browse the repository at this point in the history
  • Loading branch information
anshxika committed Nov 14, 2024
1 parent 20d98bc commit fe88a22
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions js files/script.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
const leftArrow = document.querySelector('.left-arrow');
const rightArrow = document.querySelector('.right-arrow');
const cardsWrapper = document.querySelector('.cards-wrapper');

leftArrow.addEventListener('click', () => {
cardsWrapper.scrollBy({
top: 0,
left: -200,
behavior: 'smooth'
});
});

rightArrow.addEventListener('click', () => {
cardsWrapper.scrollBy({
top: 0,
left: 200,
behavior: 'smooth'
document.addEventListener("DOMContentLoaded", function () {
var swiper = new Swiper(".mySwiper", {
slidesPerView: 1,
spaceBetween: 20,
loop: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
breakpoints: {
640: {
slidesPerView: 2,
spaceBetween: 20,
},
768: {
slidesPerView: 2,
spaceBetween: 30,
},
1024: {
slidesPerView: 2,
spaceBetween: 40,
},
},
});
});

0 comments on commit fe88a22

Please sign in to comment.