I'm just curious as to what the difference between window.outerWidth and $(window).outerWidth() is, if any.
I couldn't really find much info about this on Google, so I thought I'd appeal to the masses. This is just a general question, not a specific issue.
Jquery's outerWidth:
Returns the width of the element, along with left and right padding, border, and optionally margin, in pixels.
If includeMargin is omitted or false, the padding and border are included in the calculation; if true, the margin is also included.
This method is not applicable to window and document objects; for these, use .width() instead.
window.outerWidth:
window.outerWidth gets the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
From jQuery documentation (http://api.jquery.com/outerWidth/):
This method is not applicable to window and document objects; for these, use .width() instead.
So, you should use $(window).width(), which returns:
"width of browser viewport" (so with no window borders and other stuff)
window.outerWidth returns whole window width (with borders and other stuff)
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