Is it possible to change the width of $ (document) using jquery?

I'm new to jQuery and HTML, so this might be a very stupid question, but I'm just wondering if it is possible to change the width of a document or window using jQuery?

Is something like this possible:

$(document).ready(function() {
   $(document).width( $(window).width() );
});

      

thank

+3


source to share


1 answer


As I understand it, $ (document) .width () is read-only and will not update the width value. You may be more fortunate:

$('body').width( $(window).width() );

      



Although this would have no effect if the root element of your document / page was not larger than the viewport (eliminating horizontal scrolling).

+5


source







All Articles