mercredi 15 novembre 2017

Why does this JS not work?

I'm trying to calculate the size of 3 elements and if they're greater than the window height, apply another class to a 4 element.

This is what I have so far:

var limit = $(".logo").height() + $(".nav-items").height() + $(".nav-footer").height();
var win = $(window).height();
    $(document).ready(function(checkHeight) {
        if (limit > win) {
            var element = document.getElementById("sidebar-column");
            element.classList.toggle("red");
    }
});

Aucun commentaire:

Enregistrer un commentaire