What is the major difference between $(window).width() vs $(document).width() in jQuery?
Whether window denotes the browser and document represents the body of html page? Am I correct ?
What is the major difference between $(window).width() vs $(document).width() in jQuery? Whether window denotes
Share
From the documentation of
width():Simple jsFiddle Demo
In the demo, I have set
html { width: 1000px; }, which is bigger than the viewport.The width of the body of your HTML page is a third value.
$('body').width()can also differ from the other two (trybody { margin: 100px; }for example).