I have a content area that has controls as the footer. The controls always sit below the content area. When the content area is longer than the window.innerHeight
I want to pin (position: fixed) the footer to the bottom of the window, so the controls are always visible. If the content area is less then the window height then it sits under it again (position: relative).
I think I have achieved this when the window is resized. However I also want to listen for the #content div as it contains a textarea which can get longer than the window when the user types in it. I need some kind of event listener for this too.
window.addEventListener('resize', function() {
var viewportHeight = window.innerHeight
var contentHeight = document.getElementById('content').clientHeight;
if (contentHeight > viewportHeight) {
console.log('Larger')
} else {
console.log('Smaller')
}
}, true)
I'm using Vue.js so either this or native Javascript, I'm not using jQuery.