scrollTo(target, options = {}) {
        const start = window.pageYOffset;
        const opt = {
            duration: options.duration || 750,
            offset: options.offset || 0,
            callback: options.callback,
            easing: options.easing || easeInOutQuad
        };
        let distance = 0;
        if (typeof target === 'string') {
            distance = opt.offset + document.querySelector(target).getBoundingClientRect().top;
        } else if (typeof target === 'object') {
            distance = target.getBoundingClientRect().top;
        } else {
            distance = target;
        }

        let duration = 0;
        if (typeof opt.duration === 'function') {
            duration = opt.duration(distance);
        } else {
            duration = opt.duration;
        }

        let timeStart = 0;
        let timeElapsed = 0;

        distance = distance + opt.offset;

        requestAnimationFrame( time => {
            timeStart = time;
            loop(time);
        });

        function loop(time) {
            timeElapsed = time - timeStart;
            window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration));
            if (timeElapsed < duration) {
                requestAnimationFrame(loop);
            } else {
                end();
            }
        }

        function end() {
            window.scrollTo(0, start + distance);
            if (typeof opt.callback === 'function') {
                opt.callback();
            }
        }

        // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/
        function easeInOutQuad(t, b, c, d) {
            t /= d / 2;
            if (t < 1) return c / 2 * t * t + b;
            t--;
            return -c / 2 * (t * (t - 2) - 1) + b;
        }
    }
Smooth scrolling to DOM element or to relative window position
If target is string it should be CSS selector
If target is object it should be DOM element
If target is number - it is used to relatively scroll X pixels form current position

Based on https://www.sitepoint.com/smooth-scrolling-vanilla-javascript/

@param {HTMLElement, string, number} target
@param {object} options - duration in ms or function(distance), offset, callback function, easing function