Seems like this has been already answered here: https://stackoverflow.com/a/45859483/28365102
On top of this you could then use the native js classList property, from where you first grab the element and then add/delete a class on the element as in a style class to hide and show the footer.
More info on it: https://developer.mozilla.org/en-US/docs/Web/API/Element/classList