diff --git a/index.js b/index.js old mode 100644 new mode 100755 index b31e887..299a925 --- a/index.js +++ b/index.js @@ -41,26 +41,34 @@ WuiView.prototype.close = function () { }; /** - * disableScrolling + * set scrolling listener */ -WuiView.prototype.disableScrolling = function () { - this.allowDomEvents(); +function setScrolling(view, value) { + if (view.scrollingDisabled === undefined) { + view.allowDomEvents(); - this.scrollingDisabled = true; - var that = this; + view.on('dom.touchmove', function (e) { + // TODO: this does not work on a desktop - this.on('dom.touchmove', function (e) { - // note: this does not work on a desktop + if (view.scrollingDisabled) { + e.preventDefault(); + } + }); + } + + view.scrollingDisabled = value; +} - if (that.scrollingDisabled) { - e.preventDefault(); - } - }); +/** + * disableScrolling + */ +WuiView.prototype.disableScrolling = function () { + setScrolling(this, true); }; /** * enableScrolling */ WuiView.prototype.enableScrolling = function () { - this.scrollingDisabled = false; + setScrolling(this, false); }; \ No newline at end of file