<?php
add_action( 'facetwp_scripts', function() { ?>
<script>
(function($) {
document.addEventListener('facetwp-refresh', function() {
if ( FWP.soft_refresh == true ) {
FWP.enable_scroll = true;
} else {
FWP.enable_scroll = false;
}
});
document.addEventListener('facetwp-loaded', function() {
if (FWP.enable_scroll == true) {
var template = document.getElementsByClassName('facetwp-template');
if ( 'object' == typeof template && undefined != template[0] ) {
var offset = template[0].offsetTop;
window.scrollTo({
top: offset,
behavior: "smooth",
});
}
}
});
})(fUtil);
</script>
<?php } );