Skip to content

Commit

Permalink
fixed body class (must always be set), extra body class, removed hide…
Browse files Browse the repository at this point in the history
…Scrollbar (was implemented incorrectly and it makes no sense to have it deactivated)
  • Loading branch information
viliusle committed Aug 7, 2021
1 parent 02fddb0 commit 6f89e97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ The following options are available:
| zoomText | string | "inline svg" | Text or HTML for the zoom icon. |
| docClose | bool | true | Click outside to close Tobii. |
| swipeClose | bool | true | Swipe up to close Tobii. |
| hideScrollbar | bool | true | Hide browser scrollbars if Tobii is displayed. |
| draggable | bool | true | Use dragging and touch swiping. |
| threshold | number | 100 | Touch and mouse dragging threshold (in px). |
| autoplayVideo | bool | false | Videos will automatically start playing as soon as they can do so without stopping to finish loading the data. |
Expand Down
14 changes: 6 additions & 8 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,9 @@ export default function Tobii (userOptions) {
}
}

if (userSettings.hideScrollbar) {
document.documentElement.classList.add('tobii-is-open')
document.body.classList.add('tobii-is-open')
}
document.documentElement.classList.add('tobii-is-open')
document.body.classList.add('tobii-is-open')
document.body.classList.add('tobii-is-open-' + activeGroup)

updateConfig()

Expand Down Expand Up @@ -511,10 +510,9 @@ export default function Tobii (userOptions) {
throw new Error('Ups, I\'m already closed.')
}

if (userSettings.hideScrollbar) {
document.documentElement.classList.remove('tobii-is-open')
document.body.classList.remove('tobii-is-open')
}
document.documentElement.classList.remove('tobii-is-open')
document.body.classList.remove('tobii-is-open')
document.body.classList.remove('tobii-is-open-' + activeGroup)

unbindEvents()

Expand Down

1 comment on commit 6f89e97

@viliusle
Copy link
Collaborator Author

@viliusle viliusle commented on 6f89e97 Aug 7, 2021

Choose a reason for hiding this comment

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

@midzer you may disagree on editing README.md in this commit, but I dont see reason for this attribute, and it was implemented in a way, that should not be used. (I mean "tobii-is-open" class is good, but we need always set it, and don't check any user settings.).

Let me know if you have problems on it, I would revert readme.md and create issue.

Please sign in to comment.