I am trying to get the scrollbar width in Mozilla Firefox like this:
var scrollWt = div.offsetWidth - div.clientWidth - borderLeft - borderRight;
var scrollHt = div.offsetHeight - div.clientHeight - borderTop - borderBottom;
This is working fine in Webkit browsers, but in firefox both the values are 0
. After debugging I found that in Firefox, clientHeight
and clientWidth
are same as offsetWidth
and offsetHeight
, just excluding border
values.
How do I fix the above code to get the correct scrollbar size?
Edit:
I have tried scrollWidth
too. No luck!