0

I'm having issues with calculating the actual size of the navigator window, its returning a higher number than expected.

The actual code is the following:

function homeFullScreen() {

    var homeSection = $('.home');
    var windowHeight = $(window).outerHeight();

    if (homeSection.hasClass('home-fullscreen')) {

        $('.home-fullscreen').css('height', windowHeight);
    }
}

Also tried with .innerHeight() and .height() but doesn't work. The expected output is 820px but result is:

.home { height: 47677px; }

And this number changes even if I modify the width of the navigator window. In mobile devices number is much higher.

Does somebody figure out what is happening here?

Thank you,

Alejandra | aleare

  • This is the desired output. You probably are looking for `$(window).height();`. – Quentin Veron Apr 21 '19 at 22:52
  • https://stackoverflow.com/questions/8794338/get-the-height-and-width-of-the-browser-viewport-without-scrollbars-using-jquery – Quentin Veron Apr 21 '19 at 22:53
  • I've also tried this: var windowHeight = $(window).height(); But look at the result: height: 10359px; – aleare.design Apr 22 '19 at 19:07
  • **SOLVED** Solution was so simple and easy! Just deleted this JQuery code and added a property to the section: `code`height:100vh;`code` and it works fine in both mobile and desktop. – aleare.design Apr 23 '19 at 00:30

0 Answers0