import Event from "./_event";
import SmoothScroll from 'smooth-scroll';
let el = document.querySelector('#scrollToTop');

if (el) {
    new Event(window, 'scroll', function (event) {
        let x = window.pageYOffset || document.documentElement.scrollTop;
        if (x > 1200){
            el.style.opacity = 1;
        }else{
            el.style.opacity = 0;
        }

    });
    el.addEventListener('click', function () {
        let scroll = new SmoothScroll();
        let anchor = document.querySelector('#header');
        scroll.animateScroll(anchor);
    }, false);
}
