Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement