npm

Need private packages and team management tools?Check out npm Orgs. »

isolate-scroll

1.0.3 • Public • Published

AP Logo


Isolate Scroll

Version License

Introduction

Isolate Scroll is a small JavaScript library with no external dependency. Activating this library on an element, parents container will don't move when you scroll inside a child. This library prevent scroll on wheel and thouch event.

Browser Compatibility

Isolate Scroll supports all browsers that are ES5-compliant (IE8 and below are not supported).

Mobile support

Isolate Scroll also prevent parent scroll in mobile browsers.


Installing

With a package manager (recomanded):

npm install isolate-scroll --save 

Manually:
Download this library from https://github.com/AleeeKoi/isolate-scroll/releases


Basic usage

As ES6 module

import IsolateScroll from 'isolate-scroll';
 
var target = '.target-element';
 
// or:
// var target = document.querySelector('.target-element');
 
var isolateScrollInstance = new IsolateScroll(target);

Including directly as library

<script src="/path/to/isolateScroll.min.js"></script>
 
<script>
  (function(w) {
 
    w.addEventListener('load', function () {
      var isolateScrollInstance = IsolateScroll('.container');
    }, true);
 
  })(window);
</script> 

DOM change/resize

On inizialization this library caches some values, if DOM changes or is resized you need to manually call following method:

isolateScrollInstance.update();

License

MIT

Copyright (c) 2019-present, Alessandro Pellizzari

install

npm i isolate-scroll

Downloadsweekly downloads

6

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability