Task: the script determines the height of the block, depending on the presence of the absence of another body. I used the following option:
$("document").ready(function(){ if(window.innerWidth > 500){ if ($(".block").length) { $('#div1').css("height", "calc(100vh - 40px)"); $('#div2').css("height", "calc(50vh - 40px)"); } else { $('#div1').css("height", "100vh"); $('#div2').css("height", "50vh"); } } }); The browser displays only the value of else. What is the problem? HTML:
<body> <div class="block"></div> <div id="div1(или div2)"></div> </body>
$(window).resize(function(){...});? - Igor$("document")not necessary to write in "" - quotes. - And