$ cnpm install ng-disable-scroll
Sometimes when a certain action happens, for instance, main menu slides out, it is often desirable to prevent the main body from scrolling and only allow the menu to be scrollable.
This is fairly easy to do on desktop browsers, all that is needed is to set root container to be "overflow: hidden"; but things are not so easy on mobile, and can be very tricky.
This is where ng-disable-scroll directive comes in.
npm install --save ng-disable-scroll
bower install --save ng-disable-scroll
It is very simple to use it.
angular.module("app", [
"ngDisableScroll"
]);
or with Browserify or Webpack
angular.module("app", [
require("ng-disable-scroll").name
]);
For example when menu is open
<div ng-disable-scroll="menu.open">
...
</div>
One example use case is when there is a multi-level menu, only the second level menus are allowed to scroll
<div ng-disable-scroll="menu.open" scrollable-elements=".second-level-menu">
...
</div>
Copyright 2014 - 2016 © taobao.org |