Streaming live at 10am (PST)

Checking Element Height in real time

Dear JS ninjas,

Please advise how can I check an element’s height in real time, and when it does, it runs the function I have written below:

$(function() {
    var render = $("").height();
    var win = $(window).height();
    if (render > win) {
    } else {

Why do I need to do it in real time? That’s because the user gets to add or remove stuff as they see fit. And when they do that, I need to add or remove class to ensure the layout doesn’t break. The code works, but it needs some kind of trigger that checks the height in real time. Please advise. :smiley:

var Webflow = Webflow || [];
Webflow.push(function() {
    var $render = $("");
    setTimeout(function() {
            $render.height() >= $(window).height()
    }, 100);
1 Like

thanks @samliew. Much appreciated help!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.