-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sk9l9tik
committed
Apr 4, 2024
1 parent
a9dbd36
commit 741e157
Showing
6 changed files
with
81 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,63 @@ | ||
/* | ||
|
||
import Swiper from '../node_modules/swiper/swiper-bundle.min.mjs'; | ||
|
||
import Navigation from '../node_modules/swiper/modules/navigation.min.mjs'; | ||
import Pagination from '../node_modules/swiper/modules/pagination.min.mjs'; | ||
*/ | ||
|
||
/* | ||
import Swiper from 'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs' | ||
import Navigation from 'https://cdn.jsdelivr.net/npm/swiper@11/modules/navigation.min.mjs'; | ||
import Pagination from 'https://cdn.jsdelivr.net/npm/swiper@11/modules/pagination.min.mjs'; | ||
*/ | ||
|
||
const swiper = new Swiper('.swiper', { | ||
// configure Swiper to use modules | ||
modules: [Navigation, Pagination], | ||
}); | ||
|
||
const swp = document.querySelector(".swiper1"); | ||
|
||
/* | ||
// Optional parameters | ||
//direction: 'vertical', | ||
loop: true, | ||
const swp_slides = document.querySelectorAll(".swiper-slide1"); | ||
|
||
function handleResize(){ | ||
console.log(window.screen.width < 999); | ||
|
||
if( window.screen.width < 999){ | ||
swp.classList.add("swiper"); | ||
[...swp_slides].forEach(swp_slide =>{ | ||
swp_slide.classList.add("swiper-slide"); | ||
}) | ||
|
||
swiper1(); | ||
} | ||
|
||
else{ | ||
swp.classList.remove("swiper"); | ||
[...swp_slides].forEach(swp_slide =>{ | ||
swp_slide.classList = ""; | ||
swp_slide.classList.add("swiper-slide1"); | ||
}) | ||
} | ||
//.log(`Новые размеры: ${window.innerWidth}x${window.innerHeight}`); | ||
|
||
} | ||
|
||
if (window.addEventListener) { | ||
window.addEventListener('resize', handleResize); | ||
} | ||
else if (window.attachEvent) { | ||
window.attachEvent('onresize', handleResize); | ||
} | ||
|
||
|
||
|
||
|
||
function swiper1(){ | ||
const swiper = new Swiper('.swiper', { | ||
// configure Swiper to use modules | ||
modules: [Navigation, Pagination], | ||
loop: true, | ||
// If we need pagination | ||
pagination: { | ||
el: '.swiper-pagination', | ||
clickable:true, | ||
}, | ||
// Navigation arrows | ||
navigation: { | ||
nextEl: '.swiper-button-next', | ||
prevEl: '.swiper-button-prev', | ||
}, | ||
// And if we need scrollbar | ||
scrollbar: { | ||
el: '.swiper-scrollbar', | ||
}, | ||
*/ | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ | |
width: 45%; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters