I have tried the following and gotten the viewport width:
document.documentElement.clientWidth
and
window.innerWidth
However, what I want to get is the width of the content including overflow, for example if I had an image on the page <img src=".." style="width: 4000px !important;" />. In other words, the entire scrollable width. How would I do this?
Element.scrollWidthread-only property is a measurement of the width of an element's content, including content not visible on the screen due to overflow. If the element's content can fit without a need for horizontal scrollbar, its scrollWidth is equal to clientWidth.