JSFiddle - React, Tailwind, and code Playground
by mstefanko
HTML
<div class="proposal-view-team"><a class="proposal-team-tooltip"><img src="../CORE/images/icon_team_16x16.png" /></a></div>
JavaScript
(function($, window, document) {
var DOMSCROLL, DOWN, DRAG, MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEWHEEL, NanoScroll, PANEDOWN, RESIZE, SCROLL, SCROLLBAR, UP, WHEEL, defaults, getScrollbarWidth;
SCROLLBAR = 'scrollbar';
SCROLL = 'scroll';
MOUSEDOWN = 'mousedown';
MOUSEMOVE = 'mousemove';
MOUSEWHEEL = 'mousewheel';
MOUSEUP = 'mouseup';
RESIZE = 'resize';
DRAG = 'drag';
UP = 'up';
PANEDOWN = 'panedown';
DOMSCROLL = 'DOMMouseScroll';
DOWN = 'down';
WHEEL = 'wheel';
defaults = {
paneClass: 'pane',
sliderClass: 'slider',
contentClass: 'scrollContent',
iOSNativeScrolling: false
};
getScrollbarWidth = function() {
var outer, outerStyle, scrollbarWidth;
outer = document.createElement('div');
outerStyle = outer.style;
outerStyle.position = 'absolute';
outerStyle.width = '100px';
outerStyle.height = '100px';
outerStyle.overflow = SCROLL;
outerStyle.top = '-9999px';
document.body.appendChild(outer);
scrollbarWidth = outer.offsetWidth - outer.clientWidth;
document.body.removeChild(outer);
return scrollbarWidth;
};
NanoScroll = (function() {
NanoScroll.name = 'NanoScroll';
function NanoScroll(el, options) {
this.options = options;
this.el = $(el);
this.doc = $(document);
this.win = $(window);
this.generate();
this.createEvents();
this.addEvents();
this.reset();
}
NanoScroll.prototype.createEvents = function() {
var _this = this;
this.events = {
down: function(e) {
_this.isDrag = true;
_this.offsetY = e.clientY - _this.slider.offset().top;
_this.pane.addClass('active');
_this.doc.bind(MOUSEMOVE, _this.events[DRAG]).bind(MOUSEUP, _this.events[UP]);
return false;
},
drag: function(e) {
_this.sliderY = e.clientY - _this.el.offset().top - _this.offsetY;
_this.scroll();
return false;
},
...