adding debounce
refactoring getElementHeight