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
Hey Daniel,
Could you please clear the cache, check again and get back to us.
Best regards,
Victoria
Thanks! Issue can be closed. The solution was to add a priority to the script.
Hi Daniel,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria