Skip to content

Instantly share code, notes, and snippets.

@Benyaminrmb
Created October 4, 2022 06:07
Show Gist options
  • Save Benyaminrmb/34f3e0328371ea46793cfeabe4ab2c9b to your computer and use it in GitHub Desktop.
Save Benyaminrmb/34f3e0328371ea46793cfeabe4ab2c9b to your computer and use it in GitHub Desktop.
isCrossViewport(id) {
const rect = document.getElementById(id).getBoundingClientRect()
console.log('rect.top', rect.top)
console.log('rect.bottom', rect.bottom)
console.log('window.innerHeight', window.innerHeight)
console.log(
'document.documentElement.clientHeight',
document.documentElement.clientHeight
)
return rect.bottom <= window.innerHeight
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment