It is necessary to do so that with a width of 375px a function with a different height is executed.

$(function(){ $(".link").click(function(){ $("#infoaboutApart").css({height: '800px'}); }); }); $(function(){ $(".link").click(function(){ $(".info").css({height: '1700px'}); }); }); 

    1 answer 1

    There are several options. You can try through CSS using media queries . If it’s fundamentally js, then use window.innerWidth . You may have a typo in the code, but I did it by your examples.

    Total:

      $(function(){ $(".link").on('click', function(){ if(window.innerWidth < 376){ $("#infoaboutApart").css({height: '800px'}); $(".info").css({height: '1700px'}); }else{ //.... } }); });