.prop("clientWidth")
and .prop("scrollWidth")
var actualInnerWidth = $("body").prop("clientWidth"); // El. width minus scrollbar width
var actualInnerWidth = $("body").prop("scrollWidth"); // El. width minus scrollbar width
in JavaScript:
var actualInnerWidth = document.body.clientWidth; // El. width minus scrollbar width
var actualInnerWidth = document.body.scrollWidth; // El. width minus scrollbar width
P.S: Note that to use scrollWidth
reliably your element should not overflow horizontally
You could also use .innerWidth()
but this will work only on the body
element
var innerWidth = $('body').innerWidth(); // Width PX minus scrollbar