FacetWP – get hash clicks working

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Add the following to your (child) theme’s functions.php

add_action( ‘wp_footer’, function() {
?>

<script>
(function($) {
$(document).on(‘click’, ‘a[href^=”#”]’, function() {
var css_id = $(this).attr(‘href’);
var $el = $(css_id);
if (0 < $el.length) {
window.scrollTo(0, $el.offset().top);
}
});
})(jQuery);
</script>

<?php
}, 100 );

{{/gist}}