I have a offcanvas menu (it has display: none
by default).
Inside that menu I have my element (display: block
) and I want to get the height of this element on page load.
var myElementHeight = $(myElement).outerHeight();
Of course above code returns 0
.
Chrome Developer Tools:
Menu closed:
Menu opened:
One idea comes to my mind: clone this element, append to HTML, hide using visibility property and get the height of this element, but I think it is too tricky.