artemsemkin

Rhye theme: disable smooth scrolling on specific page

Nov 25th, 2021 (edited)
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. // Paste the code below to functions.php file of your child theme
  4.  
  5. add_action('wp_enqueue_scripts', 'rhye_child_override_page_smooth_scrolling', 60);
  6. function rhye_child_override_page_smooth_scrolling() {
  7.   $page_body_class = 'page-id-1489';
  8.  
  9.   wp_add_inline_script( 'rhye-components', '
  10.    document.addEventListener("DOMContentLoaded", () => {
  11.      if (jQuery("body").hasClass("' . $page_body_class . '")) {
  12.        jQuery("html").css("overflow", "initial");
  13.        jQuery("#page-wrapper").removeClass("js-smooth-scroll");
  14.  
  15.        if (typeof window.$pageWrapper !== "undefined" && window.$pageWrapper.length) {
  16.          window.$pageWrapper.removeClass("js-smooth-scroll");
  17.        }
  18.      }
  19.    });
  20.  ', 'before');
  21. }
Add Comment
Please, Sign In to add comment