Today I Learned

2022/09/20

js html

A hack to detect if an element is visible/not:

const isVisible = (el) => (el.offsetWidth || el.offsetHeight) > 0;

see https://stackoverflow.com/questions/1343237/how-to-check-elements-visibility-via-javascript