X Features Cars Demo Power Plants Demo State Parks Demo Site Showcase Docs Tutorials Add-ons Buy

How to Add Pagination Scrolling

FacetWP is ajax-based, meaning pagination happens without a full page reload. The trade-off is that the browser won’t automatically scroll to the top of the page upon pagination. This can be achieved with a bit of custom javascript.

<script>
(function($) {
    $(document).on('facetwp-loaded', function() {
        if (FWP.loaded) {
            $('html, body').animate({
                scrollTop: $('.facetwp-template').offset().top
            }, 500);
        }
    });
})(jQuery);
</script>

This can be added to your theme’s header.php file, right below the wp_head line.