I don't know exactly what logic you want, but you can specify a selector to make a jQuery object from thead element, and then use the .height()
and .width()
methods to get its size:
var t = $("thead"); if (t.height() > x) { t.addClass("tall"); } else { t.addClass("narrow"); }
Obviously, you can use any logic comparing height and width with each other or with an absolute number.
FYI, tall
and narrow
are usually not opposites (they can be true at the same time). I think of tall
vs. short
as opposites along with narrow
vs. wide
.
source share