@@ -1042,6 +1042,11 @@ and dependencies (minified).
1042
1042
_mwt ( ) ;
1043
1043
} else {
1044
1044
clearTimeout ( mousewheelTimeout ) ;
1045
+ /* check scroller in dom tree */
1046
+ if ( $this . parents ( 'html' ) . length === 0 ) {
1047
+ $this = null ;
1048
+ return ;
1049
+ }
1045
1050
_mousewheel . call ( $this [ 0 ] ) ;
1046
1051
}
1047
1052
} , 100 ) ;
@@ -1058,8 +1063,8 @@ and dependencies (minified).
1058
1063
}
1059
1064
} ,
1060
1065
/* -------------------- */
1061
-
1062
-
1066
+
1067
+
1063
1068
/* unbinds scrollbar events */
1064
1069
_unbindEvents = function ( ) {
1065
1070
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1082,8 +1087,8 @@ and dependencies (minified).
1082
1087
}
1083
1088
} ,
1084
1089
/* -------------------- */
1085
-
1086
-
1090
+
1091
+
1087
1092
/* toggles scrollbar visibility */
1088
1093
_scrollbarVisibility = function ( disabled ) {
1089
1094
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1128,8 +1133,8 @@ and dependencies (minified).
1128
1133
}
1129
1134
} ,
1130
1135
/* -------------------- */
1131
-
1132
-
1136
+
1137
+
1133
1138
/* returns input coordinates of pointer, touch and mouse events (relative to document) */
1134
1139
_coordinates = function ( e ) {
1135
1140
var t = e . type ;
@@ -1147,11 +1152,11 @@ and dependencies (minified).
1147
1152
}
1148
1153
} ,
1149
1154
/* -------------------- */
1150
-
1151
-
1152
- /*
1155
+
1156
+
1157
+ /*
1153
1158
SCROLLBAR DRAG EVENTS
1154
- scrolls content via scrollbar dragging
1159
+ scrolls content via scrollbar dragging
1155
1160
*/
1156
1161
_draggable = function ( ) {
1157
1162
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1173,10 +1178,10 @@ and dependencies (minified).
1173
1178
var offset = draggable . offset ( ) , y = _coordinates ( e ) [ 0 ] - offset . top , x = _coordinates ( e ) [ 1 ] - offset . left ,
1174
1179
h = draggable . height ( ) + offset . top , w = draggable . width ( ) + offset . left ;
1175
1180
if ( y < h && y > 0 && x < w && x > 0 ) {
1176
- dragY = y ;
1181
+ dragY = y ;
1177
1182
dragX = x ;
1178
1183
}
1179
- _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1184
+ _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1180
1185
} ) . bind ( "touchmove." + namespace , function ( e ) {
1181
1186
e . stopImmediatePropagation ( ) ;
1182
1187
e . preventDefault ( ) ;
@@ -1191,7 +1196,7 @@ and dependencies (minified).
1191
1196
}
1192
1197
} ) . add ( rds ) . bind ( "mouseup." + namespace + " touchend." + namespace + " pointerup." + namespace + " MSPointerUp." + namespace , function ( e ) {
1193
1198
if ( draggable ) {
1194
- _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1199
+ _onDragClasses ( draggable , "active" , o . autoExpandScrollbar ) ;
1195
1200
draggable = null ;
1196
1201
}
1197
1202
touchActive = false ;
@@ -1215,12 +1220,12 @@ and dependencies (minified).
1215
1220
}
1216
1221
} ,
1217
1222
/* -------------------- */
1218
-
1219
-
1220
- /*
1223
+
1224
+
1225
+ /*
1221
1226
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
1224
1229
*/
1225
1230
_contentDraggable = function ( ) {
1226
1231
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
@@ -1349,11 +1354,11 @@ and dependencies (minified).
1349
1354
}
1350
1355
} ,
1351
1356
/* -------------------- */
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
1357
1362
*/
1358
1363
_selectable = function ( ) {
1359
1364
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1393,7 +1398,7 @@ and dependencies (minified).
1393
1398
touchActive = false ;
1394
1399
} ) ;
1395
1400
function _sel ( ) {
1396
- return window . getSelection ? window . getSelection ( ) . toString ( ) :
1401
+ return window . getSelection ? window . getSelection ( ) . toString ( ) :
1397
1402
document . selection && document . selection . type != "Control" ? document . selection . createRange ( ) . text : 0 ;
1398
1403
}
1399
1404
function _seq ( a , c , s ) {
@@ -1403,11 +1408,11 @@ and dependencies (minified).
1403
1408
}
1404
1409
} ,
1405
1410
/* -------------------- */
1406
-
1407
-
1408
- /*
1411
+
1412
+
1413
+ /*
1409
1414
MOUSE WHEEL EVENT
1410
- scrolls content via mouse-wheel
1415
+ scrolls content via mouse-wheel
1411
1416
via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
1412
1417
*/
1413
1418
_mousewheel = function ( ) {
@@ -1465,8 +1470,8 @@ and dependencies (minified).
1465
1470
}
1466
1471
} ,
1467
1472
/* -------------------- */
1468
-
1469
-
1473
+
1474
+
1470
1475
/* checks if iframe can be accessed */
1471
1476
_canAccessIFrame = function ( iframe ) {
1472
1477
var html = null ;
@@ -1477,8 +1482,8 @@ and dependencies (minified).
1477
1482
return ( html !== null ) ;
1478
1483
} ,
1479
1484
/* -------------------- */
1480
-
1481
-
1485
+
1486
+
1482
1487
/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
1483
1488
_disableMousewheel = function ( el , target ) {
1484
1489
var tag = target . nodeName . toLowerCase ( ) ,
@@ -1488,11 +1493,11 @@ and dependencies (minified).
1488
1493
return $ . inArray ( tag , tags ) > - 1 && ! ( $ . inArray ( tag , focusTags ) > - 1 && ! $ ( target ) . is ( ":focus" ) ) ;
1489
1494
} ,
1490
1495
/* -------------------- */
1491
-
1492
-
1493
- /*
1496
+
1497
+
1498
+ /*
1494
1499
DRAGGER RAIL CLICK EVENT
1495
- scrolls content via dragger rail
1500
+ scrolls content via dragger rail
1496
1501
*/
1497
1502
_draggerRail = function ( ) {
1498
1503
var $this = $ ( this ) , d = $this . data ( pluginPfx ) ,
@@ -1524,9 +1529,9 @@ and dependencies (minified).
1524
1529
} ) ;
1525
1530
} ,
1526
1531
/* -------------------- */
1527
-
1528
-
1529
- /*
1532
+
1533
+
1534
+ /*
1530
1535
FOCUS EVENT
1531
1536
scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
1532
1537
*/
@@ -1561,8 +1566,8 @@ and dependencies (minified).
1561
1566
} ) ;
1562
1567
} ,
1563
1568
/* -------------------- */
1564
-
1565
-
1569
+
1570
+
1566
1571
/* sets content wrapper scrollTop/scrollLeft always to 0 */
1567
1572
_wrapperScroll = function ( ) {
1568
1573
var $this = $ ( this ) , d = $this . data ( pluginPfx ) ,
@@ -1575,11 +1580,11 @@ and dependencies (minified).
1575
1580
} ) ;
1576
1581
} ,
1577
1582
/* -------------------- */
1578
-
1579
-
1580
- /*
1583
+
1584
+
1585
+ /*
1581
1586
BUTTONS EVENTS
1582
- scrolls content via up, down, left and right buttons
1587
+ scrolls content via up, down, left and right buttons
1583
1588
*/
1584
1589
_buttons = function ( ) {
1585
1590
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1616,11 +1621,11 @@ and dependencies (minified).
1616
1621
} ) ;
1617
1622
} ,
1618
1623
/* -------------------- */
1619
-
1620
-
1621
- /*
1624
+
1625
+
1626
+ /*
1622
1627
KEYBOARD EVENTS
1623
- scrolls content via keyboard
1628
+ scrolls content via keyboard
1624
1629
Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
1625
1630
*/
1626
1631
_keyboard = function ( ) {
@@ -1707,8 +1712,8 @@ and dependencies (minified).
1707
1712
}
1708
1713
} ,
1709
1714
/* -------------------- */
1710
-
1711
-
1715
+
1716
+
1712
1717
/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
1713
1718
_sequentialScroll = function ( el , action , trigger , e , s ) {
1714
1719
var d = el . data ( pluginPfx ) , o = d . opt , seq = d . sequential ,
@@ -1766,8 +1771,8 @@ and dependencies (minified).
1766
1771
}
1767
1772
} ,
1768
1773
/* -------------------- */
1769
-
1770
-
1774
+
1775
+
1771
1776
/* returns a yx array from value */
1772
1777
_arr = function ( val ) {
1773
1778
var o = $ ( this ) . data ( pluginPfx ) . opt , vals = [ ] ;
@@ -1785,8 +1790,8 @@ and dependencies (minified).
1785
1790
return vals ;
1786
1791
} ,
1787
1792
/* -------------------- */
1788
-
1789
-
1793
+
1794
+
1790
1795
/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
1791
1796
_to = function ( val , dir ) {
1792
1797
if ( val == null || typeof val == "undefined" ) { return ; }
@@ -1843,15 +1848,15 @@ and dependencies (minified).
1843
1848
}
1844
1849
} ,
1845
1850
/* -------------------- */
1846
-
1847
-
1851
+
1852
+
1848
1853
/* calls the update method automatically */
1849
1854
_autoUpdate = function ( rem ) {
1850
1855
var $this = $ ( this ) , d = $this . data ( pluginPfx ) , o = d . opt ,
1851
1856
mCSB_container = $ ( "#mCSB_" + d . idx + "_container" ) ;
1852
1857
if ( rem ) {
1853
- /*
1854
- removes autoUpdate timer
1858
+ /*
1859
+ removes autoUpdate timer
1855
1860
usage: _autoUpdate.call(this,"remove");
1856
1861
*/
1857
1862
clearTimeout ( mCSB_container [ 0 ] . autoUpdate ) ;
0 commit comments