Skip to content

Commit

Permalink
Merge pull request #77 from asos-dominicjomaa/feature/export-feature-…
Browse files Browse the repository at this point in the history
…detection-boolean

Enable Dynamic Enabling / Disabling without External Feature Detection
  • Loading branch information
lazd authored Apr 25, 2022
2 parents 88a1230 + a585181 commit ec49324
Show file tree
Hide file tree
Showing 5 changed files with 782 additions and 76 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Disable iNoBounce.
* **iNoBounce.isEnabled()**
Returns a boolean indicating if iNoBounce is enabled.

* **iNoBounce.isScrollSupported**
A boolean value that indicates if the `-webkit-overflow-scrolling` css property is valid, effectively a browser detection flag.

## Will it break my app that uses touch events like other solutions?

Expand Down
7 changes: 4 additions & 3 deletions inobounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@
var testDiv = document.createElement('div');
document.documentElement.appendChild(testDiv);
testDiv.style.WebkitOverflowScrolling = 'touch';
var scrollSupport = 'getComputedStyle' in window && window.getComputedStyle(testDiv)['-webkit-overflow-scrolling'] === 'touch';
var isScrollSupported = 'getComputedStyle' in window && window.getComputedStyle(testDiv)['-webkit-overflow-scrolling'] === 'touch';
document.documentElement.removeChild(testDiv);

if (scrollSupport) {
if (isScrollSupported) {
enable();
}

// A module to support enabling/disabling iNoBounce
var iNoBounce = {
enable: enable,
disable: disable,
isEnabled: isEnabled
isEnabled: isEnabled,
isScrollSupported: isScrollSupported
};

if (typeof module !== 'undefined' && module.exports) {
Expand Down
2 changes: 1 addition & 1 deletion inobounce.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ec49324

Please sign in to comment.