I've looked at many questions regarding this subject and can not seem to find out what is wrong with my code. Any help would be greatly appreciated!
$(window).resize(function(){
   var newwidth = $(window).innerWidth();
   var newheight = $(window).innerHeight();      
   $("#element").height(newheight).width(newwidth);
       });
I'm trying to resize #element to the same height and width as the window if the window is resized.
About .innerWidth(), from docs:   
This method is not applicable to window and document objects; for these, use .width() instead.
There is same note for .innerHeight() also.
So you need to use .width() and .height():
$(window).resize(function(){
    var newwidth = $(window).width();
    var newheight = $(window).height();      
    $("#element").height(newheight).width(newwidth);
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With