mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 04:21:17 +01:00
closes #5152
This commit is contained in:
@@ -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",
|
||||
|
||||
32
public/src/modules/scrollStop.js
Normal file
32
public/src/modules/scrollStop.js
Normal 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;
|
||||
});
|
||||
Reference in New Issue
Block a user