How to get an element height

Hey there,
I’m doing some coding building my website–> giannaccinilorenzoimmobiliare . com

As you can see, in the homepage and on each property page there is one slider in top, and a tab in the bottom. I calculate your browser’s height and the tab connected to the rest of the site’s page starts at the bottom of your screen. When the site is loaded on tablets or big monitors, since the slider height could be smaller than monitor’s height, you will see a gap between the slider and the rest of the page.

I want to calculate the slider’s height, since its stretched to the monitor and adapts to the screen, and I’ve tried using this code:

$w("#slider").height;

as I saw it in this documentation intense-brook-61045.herokuapp. com/$w.Element.html#height

But it doesn’t work, I get this error message: ‘height’ does not exist in ‘#slider’.

How can I calculate an element’s height?

Note, that you should be referring to the official Wix Velo API documentation and certainly not an unauthorized copy.

I don’t think you can do it with pure Velo, but if you have a premium account, you can do it with a custom element using document.getElementById(“ID”).offsetHeight;.

I have a premium account linked to my website, but still it says ‘document’ is not defined.

I checked all the official documentation and found nothing in reference to calculating the height or width of an element.

@giannaccinilorenzo because you can’t do it with Velo. You need to create a custom element and write the code for it if you know how to use html, css and js.

@jonatandor35 creating a custom element does not work for what I need, since custom elements are just “custom boxes”, but they still are considered as Wix elements outside their boxes, I can only code stuff inside a custom element’s box, not its own properties in Wix editor.

For what I want to do, I need to make something like this:

$w("#strip").offsetHeight = window.innerHeight;

But offsetHeight and window.innerHeight aren’t defined in Wix editor.