Skip to content

Instantly share code, notes, and snippets.

@tiansial

tiansial/home.js Secret

Created October 12, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiansial/64f96c068c4415f151fba1d8d4cc1d37 to your computer and use it in GitHub Desktop.
Save tiansial/64f96c068c4415f151fba1d8d4cc1d37 to your computer and use it in GitHub Desktop.
/*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