@@ -1042,6 +1042,11 @@ and dependencies (minified).
10421042 _mwt ( ) ;
10431043 } else {
10441044 clearTimeout ( mousewheelTimeout ) ;
1045+ /* check scroller in dom tree */
1046+ if ( $this . parents ( 'html' ) . length === 0 ) {
1047+ $this = null ;
1048+ return ;
1049+ }
10451050 _mousewheel . call ( $this [ 0 ] ) ;
10461051 }
10471052 } , 100 ) ;
@@ -1058,8 +1063,8 @@ and dependencies (minified).
10581063 }
10591064 } ,
10601065 /* -------------------- */
1061-
1062-
1066+
1067+
10631068 /* unbinds scrollbar events */
10641069 _unbindEvents = function ( ) {
10651070 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1082,8 +1087,8 @@ and dependencies (minified).
10821087 }
10831088 } ,
10841089 /* -------------------- */
1085-
1086-
1090+
1091+
10871092 /* toggles scrollbar visibility */
10881093 _scrollbarVisibility = function ( disabled ) {
10891094 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1128,8 +1133,8 @@ and dependencies (minified).
11281133 }
11291134 } ,
11301135 /* -------------------- */
1131-
1132-
1136+
1137+
11331138 /* returns input coordinates of pointer, touch and mouse events (relative to document) */
11341139 _coordinates = function ( e ) {
11351140 var t = e . type ;
@@ -1147,11 +1152,11 @@ and dependencies (minified).
11471152 }
11481153 } ,
11491154 /* -------------------- */
1150-
1151-
1152- /*
1155+
1156+
1157+ /*
11531158 SCROLLBAR DRAG EVENTS
1154- scrolls content via scrollbar dragging
1159+ scrolls content via scrollbar dragging
11551160 */
11561161 _draggable = function ( ) {
11571162 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1173,10 +1178,10 @@ and dependencies (minified).
11731178 var offset = draggable . offset ( ) , y = _coordinates ( e ) [ 0 ] - offset . top , x = _coordinates ( e ) [ 1 ] - offset . left ,
11741179 h = draggable . height ( ) + offset . top , w = draggable . width ( ) + offset . left ;
11751180 if ( y < h && y > 0 && x < w && x > 0 ) {
1176- dragY = y ;
1181+ dragY = y ;
11771182 dragX = x ;
11781183 }
1179- _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1184+ _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
11801185 } ) . bind ( "touchmove." + namespace , function ( e ) {
11811186 e . stopImmediatePropagation ( ) ;
11821187 e . preventDefault ( ) ;
@@ -1191,7 +1196,7 @@ and dependencies (minified).
11911196 }
11921197 } ) . add ( rds ) . bind ( "mouseup." + namespace + " touchend." + namespace + " pointerup." + namespace + " MSPointerUp." + namespace , function ( e ) {
11931198 if ( draggable ) {
1194- _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1199+ _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
11951200 draggable = null ;
11961201 }
11971202 touchActive = false ;
@@ -1215,12 +1220,12 @@ and dependencies (minified).
12151220 }
12161221 } ,
12171222 /* -------------------- */
1218-
1219-
1220- /*
1223+
1224+
1225+ /*
12211226 TOUCH SWIPE EVENTS
1222- scrolls content via touch swipe
1223- Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices
1227+ scrolls content via touch swipe
1228+ Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices
12241229 */
12251230 _contentDraggable = function ( ) {
12261231 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1349,11 +1354,11 @@ and dependencies (minified).
13491354 }
13501355 } ,
13511356 /* -------------------- */
1352-
1353-
1354- /*
1355- SELECT TEXT EVENTS
1356- scrolls content when text is selected
1357+
1358+
1359+ /*
1360+ SELECT TEXT EVENTS
1361+ scrolls content when text is selected
13571362 */
13581363 _selectable = function ( ) {
13591364 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1393,7 +1398,7 @@ and dependencies (minified).
13931398 touchActive = false ;
13941399 } ) ;
13951400 function _sel ( ) {
1396- return window . getSelection ? window . getSelection ( ) . toString ( ) :
1401+ return window . getSelection ? window . getSelection ( ) . toString ( ) :
13971402 document . selection && document . selection . type != "Control" ? document . selection . createRange ( ) . text : 0 ;
13981403 }
13991404 function _seq ( a , c , s ) {
@@ -1403,11 +1408,11 @@ and dependencies (minified).
14031408 }
14041409 } ,
14051410 /* -------------------- */
1406-
1407-
1408- /*
1411+
1412+
1413+ /*
14091414 MOUSE WHEEL EVENT
1410- scrolls content via mouse-wheel
1415+ scrolls content via mouse-wheel
14111416 via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
14121417 */
14131418 _mousewheel = function ( ) {
@@ -1465,8 +1470,8 @@ and dependencies (minified).
14651470 }
14661471 } ,
14671472 /* -------------------- */
1468-
1469-
1473+
1474+
14701475 /* checks if iframe can be accessed */
14711476 _canAccessIFrame = function ( iframe ) {
14721477 var html = null ;
@@ -1477,8 +1482,8 @@ and dependencies (minified).
14771482 return ( html !== null ) ;
14781483 } ,
14791484 /* -------------------- */
1480-
1481-
1485+
1486+
14821487 /* disables mouse-wheel when hovering specific elements like select, datalist etc. */
14831488 _disableMousewheel = function ( el , target ) {
14841489 var tag = target . nodeName . toLowerCase ( ) ,
@@ -1488,11 +1493,11 @@ and dependencies (minified).
14881493 return $ . inArray ( tag , tags ) > - 1 && ! ( $ . inArray ( tag , focusTags ) > - 1 && ! $ ( target ) . is ( ":focus" ) ) ;
14891494 } ,
14901495 /* -------------------- */
1491-
1492-
1493- /*
1496+
1497+
1498+ /*
14941499 DRAGGER RAIL CLICK EVENT
1495- scrolls content via dragger rail
1500+ scrolls content via dragger rail
14961501 */
14971502 _draggerRail = function ( ) {
14981503 var $this = $ ( this ) , d = $this . data ( pluginPfx ) ,
@@ -1524,9 +1529,9 @@ and dependencies (minified).
15241529 } ) ;
15251530 } ,
15261531 /* -------------------- */
1527-
1528-
1529- /*
1532+
1533+
1534+ /*
15301535 FOCUS EVENT
15311536 scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
15321537 */
@@ -1561,8 +1566,8 @@ and dependencies (minified).
15611566 } ) ;
15621567 } ,
15631568 /* -------------------- */
1564-
1565-
1569+
1570+
15661571 /* sets content wrapper scrollTop/scrollLeft always to 0 */
15671572 _wrapperScroll = function ( ) {
15681573 var $this = $ ( this ) , d = $this . data ( pluginPfx ) ,
@@ -1575,11 +1580,11 @@ and dependencies (minified).
15751580 } ) ;
15761581 } ,
15771582 /* -------------------- */
1578-
1579-
1580- /*
1583+
1584+
1585+ /*
15811586 BUTTONS EVENTS
1582- scrolls content via up, down, left and right buttons
1587+ scrolls content via up, down, left and right buttons
15831588 */
15841589 _buttons = function ( ) {
15851590 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1616,11 +1621,11 @@ and dependencies (minified).
16161621 } ) ;
16171622 } ,
16181623 /* -------------------- */
1619-
1620-
1621- /*
1624+
1625+
1626+ /*
16221627 KEYBOARD EVENTS
1623- scrolls content via keyboard
1628+ scrolls content via keyboard
16241629 Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
16251630 */
16261631 _keyboard = function ( ) {
@@ -1707,8 +1712,8 @@ and dependencies (minified).
17071712 }
17081713 } ,
17091714 /* -------------------- */
1710-
1711-
1715+
1716+
17121717 /* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
17131718 _sequentialScroll = function ( el , action , trigger , e , s ) {
17141719 var d = el . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1766,8 +1771,8 @@ and dependencies (minified).
17661771 }
17671772 } ,
17681773 /* -------------------- */
1769-
1770-
1774+
1775+
17711776 /* returns a yx array from value */
17721777 _arr = function ( val ) {
17731778 var o = $ ( this ) . data ( pluginPfx ) . opt , vals = [ ] ;
@@ -1785,8 +1790,8 @@ and dependencies (minified).
17851790 return vals ;
17861791 } ,
17871792 /* -------------------- */
1788-
1789-
1793+
1794+
17901795 /* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
17911796 _to = function ( val , dir ) {
17921797 if ( val == null || typeof val == "undefined" ) { return ; }
@@ -1843,15 +1848,15 @@ and dependencies (minified).
18431848 }
18441849 } ,
18451850 /* -------------------- */
1846-
1847-
1851+
1852+
18481853 /* calls the update method automatically */
18491854 _autoUpdate = function ( rem ) {
18501855 var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
18511856 mCSB_container = $ ( "#mCSB_" + d . idx + "_container" ) ;
18521857 if ( rem ) {
1853- /*
1854- removes autoUpdate timer
1858+ /*
1859+ removes autoUpdate timer
18551860 usage: _autoUpdate.call(this,"remove");
18561861 */
18571862 clearTimeout ( mCSB_container [ 0 ] . autoUpdate ) ;
0 commit comments