This commit is contained in:
Julian Lam
2016-10-24 11:12:39 -04:00
parent 735461d2f9
commit 9a0d81ef6b
2 changed files with 33 additions and 1 deletions

View File

@@ -52,7 +52,7 @@
"morgan": "^1.3.2",
"mousetrap": "^1.5.3",
"nconf": "~0.8.2",
"nodebb-plugin-composer-default": "4.2.12",
"nodebb-plugin-composer-default": "4.2.13",
"nodebb-plugin-dbsearch": "1.0.3",
"nodebb-plugin-emoji-extended": "1.1.1",
"nodebb-plugin-emoji-one": "1.1.5",

View File

@@ -0,0 +1,32 @@
'use strict';
/* globals console, define */
/*
The point of this library is to enhance(tm) a textarea so that if scrolled,
you can only scroll to the top of it and the event doesn't bubble up to
the document... because it does... and it's annoying at times.
While I'm here, might I say this is a solved issue on Linux?
*/
define('scrollStop', function () {
var Module = {};
Module.apply = function (element) {
$(element).on('mousewheel', function (e) {
var scrollTop = this.scrollTop;
var scrollHeight = this.scrollHeight;
var elementHeight = this.getBoundingClientRect().height;
if (
(e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up
(e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) > scrollHeight) // scroll down
) {
return false;
}
});
};
return Module;
});