I'm trying to add some css to an element if the height of the document is taller than the viewport.
var docH = $(document).height(),
viewPortH = $(window).height();
console.log(docH);
console.log(viewPortH);
if (docH > viewPortH) {
$('.slick-slide img').css('max-width', '90%');
}
However, console.log()
outputs both docH
and viewPortH
as 733 which is not the case.
I have the html
set to height: 100%
and the body
set to min-height: 100%
. Is there anything I missed?
I looked over some of the other similar questions here and I seemed to have done everything correctly.