Skip to content

add browser scrollbar width detection#37

Open
seb3s wants to merge 1 commit intobuzinas:masterfrom
seb3s:teamup
Open

add browser scrollbar width detection#37
seb3s wants to merge 1 commit intobuzinas:masterfrom
seb3s:teamup

Conversation

@seb3s
Copy link

@seb3s seb3s commented Feb 10, 2018

I've added a simple function to detect the browser scrollbar width and adapt the style offset to this exact value.

Copy link

@begrs begrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its definetely a rough work around to attach an element to the dom to check the width but ++ for cross browser fix that should work 100% of the time.
Withouth this fix, simple scrollbar does not work properly for mobile browsers with no permanent scrollbars or Safari 11.1. (even though the docu states it should)

Copy link

@begrs begrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for missing this in my last review:
this does not work if the script is added before the dom is loaded.

but its easy to fix:
d.addEventListener('DOMContentLoaded', function () { ss.scrollWidth = getScrollWidth(); initAll(); }); ss.initEl = initEl; ss.initAll = initAll;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants