Skip to content

Instantly share code, notes, and snippets.

@git-bhanu
Created August 19, 2020 16:57
Show Gist options
  • Save git-bhanu/2f9660dd0b4277b65293843b9048eb91 to your computer and use it in GitHub Desktop.
Save git-bhanu/2f9660dd0b4277b65293843b9048eb91 to your computer and use it in GitHub Desktop.
Importing and Exporting ES6 modules for sage roots.
PAGE NAME : group-slider.js at "script/components/group-slider.js"
//////////////////////////////
import Swiper, {Navigation, Pagination} from 'swiper';
Swiper.use([Navigation, Pagination]);
const groupSlider = new Swiper('#group-cards', {
spaceBetween: 5,
speed: 300,
loop: true,
centeredSlides: true,
slidesPerView: 'auto',
mousewheelControl: true,
keyboardControl: true,
observer: true,
observeParents: true,
breakpoints: {
728: {
grabCursor: true,
observer: true,
observeParents: true,
slidesPerView: 3,
spaceBetween: 25,
mousewheelControl: true,
keyboardControl: true,
centeredSlides: false,
},
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.group-swiper-button-next-outside',
prevEl: '.group-swiper-button-prev-outside',
},
})
export default groupSlider;
////////////////////////////
I have to now use this at my home.js router file then
///////////////////////////
import groupSlider from '../components/group-slider';
export default {
init() {
groupSlider.init();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment