Tuesday, September 4, 2018

Get height of screen window and height of div jquery

<body class="main">
   <div class="main-banner" style="background:red;">
   </div>
</body>

   $(document).ready(function() {
        function setHeight() {
            windowHeight = $(window).innerHeight();
            $('.main-banner').css('height', windowHeight);
        };
                
        setHeight();
        $(window).resize(function() {
            setHeight();
        });
    })

 
    

No comments:

Post a Comment

For Professional website contact WEB CODE ADDICT

View this post on Instagram A post shared by WebCodeAddict (@webcodeaddicted)