Last active
April 4, 2019 02:08
-
-
Save joelcardinal/ecb26d8856a1023cbe4539a2492315d0 to your computer and use it in GitHub Desktop.
Get's element offset from bottom of page to bottom of given element. Useful for test automation to determine if pixel tags are pushing up your footer.
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
(function(){ | |
var el = document.querySelector('.footer-wrapper'), | |
rect = el.getBoundingClientRect(), | |
scrollTopOffset = window.pageYOffset || document.documentElement.scrollTop, | |
offsetFromBottom = document.documentElement.scrollHeight - (rect.top + scrollTopOffset + rect.height); | |
return offsetFromBottom > 0; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment