Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1191909

    Hi!

    I am trying to fade out h2 titles when they scroll to the top. I am using this jQuery to establish that:

    
    // Fade titles on scroll to top
    function fade_titles(){
        ?>
        <script>
            jQuery(window).scroll(function () {
                jQuery('h2').each(function () {
                    if ((jQuery(this).offset().top - jQuery(window).scrollTop()) < 350) {
                        jQuery(this).stop().fadeTo(100, 0);
                    } else {
                        jQuery(this).stop().fadeTo('fast', 1);
                    }
                });
            });
        </script>
        <?php
    }
    add_action('wp_footer', 'fade_titles');
    

    You can see it in action here: https://jsfiddle.net/24epvfjq/

    But on my Enfold site, the h2 titles won’t fade out. Do you have any idea why this is not working and can you help me to get it working?

    Thanks!
    Daniel

    • This topic was modified 4 years, 9 months ago by Daniel.
    #1192721

    Hey Daniel,

    Could you please clear the cache, check again and get back to us.

    Best regards,
    Victoria

    #1192726

    Thanks! Issue can be closed. The solution was to add a priority to the script.

    #1192776

    Hi Daniel,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.