Created
          October 29, 2018 21:10 
        
      - 
      
- 
        Save djrmom/971940882f87a5ce0bdcdfd83ae8a9ae to your computer and use it in GitHub Desktop. 
    facetwp conditional scroll to top only on pager
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** scoll on loaded only if pager is the change in facet **/ | |
| add_action( 'wp_head', function() { ?> | |
| <script> | |
| (function($) { | |
| $(document).on('facetwp-refresh', function() { | |
| if ( FWP.soft_refresh == true ) { | |
| FWP.enable_scroll = true; | |
| } else { | |
| FWP.enable_scroll = false; | |
| } | |
| }); | |
| $(document).on('facetwp-loaded', function() { | |
| if ( FWP.enable_scroll == true ) { | |
| $('html, body').animate({ scrollTop: 0 }, 500); | |
| } | |
| }); | |
| })(jQuery); | |
| </script> | |
| <?php } ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
How do I custimize this code to a specific page? I want that some pages only scroll to a certain point and on default to top