daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // add a class to the html when the page is scrolled
  3.  
  4. function add_html_scroll_class(){
  5.     ?>
  6.     <script>
  7.     (function($){
  8.         $(window).scroll(function() {
  9.             if($(window).scrollTop() > 0) {
  10.             $('html').addClass('html-scrolled');
  11.             $('html').removeClass('html-not-scrolled');
  12.         } else {    
  13.             $('html').addClass('html-not-scrolled');
  14.             $('html').removeClass('html-scrolled');
  15.             }
  16.         });
  17.     })(jQuery);
  18.     </script>
  19.     <?php
  20.     }
  21.     add_action('wp_footer', 'add_html_scroll_class');
RAW Paste Data
Top