Created
February 1, 2019 22:23
-
-
Save mysy00/c0b9a154a12e5cdceae8500d4dd02197 to your computer and use it in GitHub Desktop.
This file contains 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
function getOffset( el ) { | |
var _y = 0; | |
while( el && !isNaN( el.offsetTop ) ) { | |
_y += el.offsetTop - el.scrollTop; | |
el = el.offsetParent; | |
} | |
return { top: _y }; | |
} | |
if ( getOffset( document.querySelector('.section-5') ).top <= window.scrollY && (getOffset( document.querySelector('.section-5') ).top + document.querySelector('.section-5').clientHeight) >= window.scrollY) { | |
document.querySelector('.section-menu-label').style.filter="invert(1)" | |
} else { | |
document.querySelector('.section-menu-label').style.filter="invert(0)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment