(function(GW, $) {
'use strict';
let button;
/**
* Scrolls to top of page.
*
* @param {event} event - Prevents the default event of the trigger.
*/
function animateToTop(event) {
event.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
GW.backToTop = {
init: function() {
button = document.querySelector('.js-back-to-top');
if (button) {
button.addEventListener('click', animateToTop);
}
}
};
}(window.GW = window.GW || {}, jQuery));