Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // add a class to the html when the page is scrolled
- function add_html_scroll_class(){
- ?>
- <script>
- (function($){
- $(window).scroll(function() {
- if($(window).scrollTop() > 0) {
- $('html').addClass('html-scrolled');
- $('html').removeClass('html-not-scrolled');
- } else {
- $('html').addClass('html-not-scrolled');
- $('html').removeClass('html-scrolled');
- }
- });
- })(jQuery);
- </script>
- <?php
- }
- add_action('wp_footer', 'add_html_scroll_class');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement