Created
July 27, 2020 00:13
-
-
Save lukapaunovic/412261dde45dd955161ec747935a2380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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