When the width is under 1024, I want the body of the page to scale to fit the user's screen without a scrollbar. My goal is to adjust the entire body so that it fits within the browser window without a scrollbar when the width is under 1024. I attempted the following approach:
function resizeWindow() {
$(window).off('scroll');
windowWidth = $(window).width();
console.log(windowWidth);
if (windowWidth > 1024)
{
console.log(">1024");
}else if (windowWidth <= 1024)
{
$('body').css('height', '100vh');
$('body').css('width', '100vw')
}
}
$(window).resize(resizeWindow);
CSS:
body, html {
height: 100%;
width: 100%;
}