Skip to content

Instantly share code, notes, and snippets.

@tiansial tiansial/home.js Secret
Created Oct 12, 2018

Embed
What would you like to do?
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "homeSwiper" }]*/
import Swiper from 'swiper';
import { TweenMax, EasePack, TimelineMax } from 'gsap'; // eslint-disable-line
import Barba from 'barba.js/dist/barba.min';
export default {
init() {
const home = Barba.BaseView.extend({
namespace: 'home',
onEnter: function() {
},
onEnterCompleted: function() {
var homepageSlider = document.getElementById('homepageSwiper'),
homepageCardsTimeline = new TimelineMax({ paused: true });
homepageCardsTimeline
.staggerTo('.homepage-selects--each', 1.2, {
delay: 0.3,
css: {
marginTop: 80,
},
ease:Power3.easeOut,
}, .030);// eslint-disable-line
// build homepage slider
var homeSwiper = new Swiper (homepageSlider, {
slidesPerView: 1,
speed: 1000,
loop: false,
scrollBar: false,
centeredSlides: true,
autoplay: true,
observer: true,
observeParents: true,
navigation: {
nextEl: '.homepage__swiper-next',
prevEl: '.homepage__swiper-prev',
},
});
console.log('test');
},
onLeave: function() {
},
onLeaveCompleted: function() {
// The Container has just been removed from the DOM.
},
});
home.init();
},
finalize() {
// JavaScript to be fired on the home page, after the init JS
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.