Skip to content

Instantly share code, notes, and snippets.

@ManotLuijiu
Last active February 23, 2021 07:33
Show Gist options
  • Save ManotLuijiu/c1909260ba24da0715e9376608b05273 to your computer and use it in GitHub Desktop.
Save ManotLuijiu/c1909260ba24da0715e9376608b05273 to your computer and use it in GitHub Desktop.
How to hide element in JavaScript
document.onscroll = function() {
if (window.innerHeight + window.scrollY > document.body.clientHeight) {
document.getElementById('means__social__th').style.display='none';
}
if (document.getElementById('means__social__th') && \
window.innerHeight + window.scrollY < document.body.clientHeight) \
{
document.getElementById('means__social__th').style.display='block';
}
}
// บรรทัดที่ 5 มีเครื่องหมาย "และ" หรือ "&&" แสดงว่า เงื่อนไขต้องเป็นจริงทั้งคู่ มันถึงจะทำงาน
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment