This asset controls sections in a page.
It resizes sections to fullscreen resolution and moves these individually by wheel/touch events.
https://ykob.github.io/fullscreen-slider/
- You must install the necessary npm modules.
This class depends on below modules.
https://www.npmjs.com/package/normalize-wheel
npm i normalize-wheel --save
- Import FullscreenSlider class.
https://github.com/ykob/fullscreen-slider/blob/master/src/js/modules/fullscreen_slider/index.js
Like as below.
import FullscreenSlider from '../modules/fullscreen_slider/';
- Create an instance and set wrapper element (ex: document) and 2D resolution object to arguments as below.
const fsSlider = new FullscreenSlider(
document,
{
x: window.innerWidth,
y: window.innerHeight
}
);
- Bind the
resize
event. You should run thereset
method before running theresize
method to set the resolution to the section elements correctly. Also, you should set an object that has window resolution to an argument of the "resize" method to resize the sections to full-screen size.
window.addEventListener('resize', () => {
fsSlider.reset();
fsSlider.resize(
{
x: window.innerWidth,
y: window.innerHeight
}
);
});
- Run the
start
method when you want to start the animation.
fsSlider.start();