instantclick icon indicating copy to clipboard operation
instantclick copied to clipboard

Instant Click loading bar width calculations are based off page width plus width of scrollbar

Open wpgbrown opened this issue 8 years ago • 1 comments

I am using the minified version of instant click version 3.1.0 (current)

I have a page that uses a fixed navbar and content that is not fixed, but when the instant click loading bar is created, it uses innerWidth instead of clientHeight. This causes on my page the width of the element to be more than the current page width, as it includes the width of the scrollbar. This seems to work in normal cases, but in my case this causes the page to have problems with horizontal scrollbars (and coupled with the moving of the scrollbar, moves the instant click loading bar to the left, it causes more problems).

My suggestion would be to either use clientWidth if the doctype is set (as it is inaccurate if it is not set) and then use innerWidth when it is not or to have a configuration option when initialised to use clientWidth instead of innerWidth.

Thanks, Wpgbrown

wpgbrown avatar Dec 18 '17 22:12 wpgbrown

I have done some tests and have concluded that using document.documentElement.clientWidth is better than innerWidth

wpgbrown avatar Dec 18 '17 22:12 wpgbrown