jQuery.fn.isInViewport = function() { | |
var elementTop = jQuery(this).offset().top; | |
var elementBottom = elementTop + jQuery(this).outerHeight(); | |
var viewportTop = jQuery(window).scrollTop(); | |
var viewportBottom = viewportTop + jQuery(window).height(); | |
return elementBottom > viewportTop && elementTop < viewportBottom; | |
}; | |
window.lazyprocess = 'yes'; | |
jQuery(window).on('resize scroll', function() { | |
if (jQuery('.et_pb_section_6').isInViewport()) { | |
if (window.lazyprocess == 'yes') { | |
window.lazyprocess = 'no'; | |
jQuery('div.et_pb_section.et_pb_section_7').css('background-image', 'linear-gradient(272deg,rgba(0,25,93,0.17) -2%,rgba(0,25,93,0.95) 82%),url(https://infocus.org/wp-content/uploads/2020/03/giffocus.gif)'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment