document.addEventListener('DOMContentLoaded', function() {
  var buttons = document.querySelectorAll('.chbs-button-step-next, .chbs-button-step-prev');

  for (var i = 0; i < buttons.length; i++) {
    buttons[i].addEventListener('click', function() {
      if (window.innerWidth <= 640) {
        setTimeout(function(){scrollToTop();},1500);
      }
    });
  }

  function scrollToTop() {
    window.scrollTo({
      top: 0,
      behavior: 'smooth'
    });
  }
});
