When can the values of the two differ?
When you have a scrollbar on the webpage.
Document.width will show the total width of the document.but window.width will return the current width of the window itself,if its been rezied.
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document
please check this link for more details.here
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