mirror of https://github.com/ColorlibHQ/AdminLTE
Fixed IE10 issue
parent
174be54e9b
commit
f84eb88bcf
|
@ -11,70 +11,48 @@
|
||||||
slimScroll: function (options) {
|
slimScroll: function (options) {
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
|
|
||||||
// width in pixels of the visible scroll area
|
// width in pixels of the visible scroll area
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
|
|
||||||
// height in pixels of the visible scroll area
|
// height in pixels of the visible scroll area
|
||||||
height: '250px',
|
height: '250px',
|
||||||
|
|
||||||
// width in pixels of the scrollbar and rail
|
// width in pixels of the scrollbar and rail
|
||||||
size: '7px',
|
size: '7px',
|
||||||
|
|
||||||
// scrollbar color, accepts any hex/color value
|
// scrollbar color, accepts any hex/color value
|
||||||
color: '#000',
|
color: '#000',
|
||||||
|
|
||||||
// scrollbar position - left/right
|
// scrollbar position - left/right
|
||||||
position: 'right',
|
position: 'right',
|
||||||
|
|
||||||
// distance in pixels between the side edge and the scrollbar
|
// distance in pixels between the side edge and the scrollbar
|
||||||
distance: '1px',
|
distance: '1px',
|
||||||
|
|
||||||
// default scroll position on load - top / bottom / $('selector')
|
// default scroll position on load - top / bottom / $('selector')
|
||||||
start: 'top',
|
start: 'top',
|
||||||
|
|
||||||
// sets scrollbar opacity
|
// sets scrollbar opacity
|
||||||
opacity: .4,
|
opacity: .4,
|
||||||
|
|
||||||
// enables always-on mode for the scrollbar
|
// enables always-on mode for the scrollbar
|
||||||
alwaysVisible: false,
|
alwaysVisible: false,
|
||||||
|
|
||||||
// check if we should hide the scrollbar when user is hovering over
|
// check if we should hide the scrollbar when user is hovering over
|
||||||
disableFadeOut: false,
|
disableFadeOut: false,
|
||||||
|
|
||||||
// sets visibility of the rail
|
// sets visibility of the rail
|
||||||
railVisible: false,
|
railVisible: false,
|
||||||
|
|
||||||
// sets rail color
|
// sets rail color
|
||||||
railColor: '#333',
|
railColor: '#333',
|
||||||
|
|
||||||
// sets rail opacity
|
// sets rail opacity
|
||||||
railOpacity: .2,
|
railOpacity: .2,
|
||||||
|
|
||||||
// whether we should use jQuery UI Draggable to enable bar dragging
|
// whether we should use jQuery UI Draggable to enable bar dragging
|
||||||
railDraggable: true,
|
railDraggable: true,
|
||||||
|
|
||||||
// defautlt CSS class of the slimscroll rail
|
// defautlt CSS class of the slimscroll rail
|
||||||
railClass: 'slimScrollRail',
|
railClass: 'slimScrollRail',
|
||||||
|
|
||||||
// defautlt CSS class of the slimscroll bar
|
// defautlt CSS class of the slimscroll bar
|
||||||
barClass: 'slimScrollBar',
|
barClass: 'slimScrollBar',
|
||||||
|
|
||||||
// defautlt CSS class of the slimscroll wrapper
|
// defautlt CSS class of the slimscroll wrapper
|
||||||
wrapperClass: 'slimScrollDiv',
|
wrapperClass: 'slimScrollDiv',
|
||||||
|
|
||||||
// check if mousewheel should scroll the window if we reach top/bottom
|
// check if mousewheel should scroll the window if we reach top/bottom
|
||||||
allowPageScroll: false,
|
allowPageScroll: false,
|
||||||
|
|
||||||
// scroll amount applied to each mouse wheel step
|
// scroll amount applied to each mouse wheel step
|
||||||
wheelStep: 20,
|
wheelStep: 20,
|
||||||
|
|
||||||
// scroll amount applied when user is using gestures
|
// scroll amount applied when user is using gestures
|
||||||
touchScrollStep: 200,
|
touchScrollStep: 200,
|
||||||
|
|
||||||
// sets border radius
|
// sets border radius
|
||||||
borderRadius: '7px',
|
borderRadius: '7px',
|
||||||
|
|
||||||
// sets border radius of the rail
|
// sets border radius of the rail
|
||||||
railBorderRadius: '7px'
|
railBorderRadius: '7px'
|
||||||
};
|
};
|
||||||
|
@ -167,7 +145,9 @@
|
||||||
me.css({
|
me.css({
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
width: o.width,
|
width: o.width,
|
||||||
height: o.height
|
height: o.height,
|
||||||
|
//Fix for IE10
|
||||||
|
"-ms-touch-action": "none"
|
||||||
});
|
});
|
||||||
|
|
||||||
// create scrollbar rail
|
// create scrollbar rail
|
||||||
|
@ -229,7 +209,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$doc.bind("mouseup.slimscroll", function (e) {
|
$doc.bind("mouseup.slimscroll", function (e) {
|
||||||
isDragg = false;hideBar();
|
isDragg = false;
|
||||||
|
hideBar();
|
||||||
$doc.unbind('.slimscroll');
|
$doc.unbind('.slimscroll');
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@ -264,6 +245,30 @@
|
||||||
hideBar();
|
hideBar();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (window.navigator.msPointerEnabled) {
|
||||||
|
// support for mobile
|
||||||
|
me.bind('MSPointerDown', function (e, b) {
|
||||||
|
if (e.originalEvent.targetTouches.length)
|
||||||
|
{
|
||||||
|
// record where touch started
|
||||||
|
touchDif = e.originalEvent.targetTouches[0].pageY;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
me.bind('MSPointerMove', function (e) {
|
||||||
|
// prevent scrolling the page if necessary
|
||||||
|
e.originalEvent.preventDefault();
|
||||||
|
if (e.originalEvent.targetTouches.length)
|
||||||
|
{
|
||||||
|
// see how far user swiped
|
||||||
|
var diff = (touchDif - e.originalEvent.targetTouches[0].pageY) / o.touchScrollStep;
|
||||||
|
// scroll content
|
||||||
|
scrollContent(diff, true);
|
||||||
|
touchDif = e.originalEvent.targetTouches[0].pageY;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
// support for mobile
|
// support for mobile
|
||||||
me.bind('touchstart', function (e, b) {
|
me.bind('touchstart', function (e, b) {
|
||||||
if (e.originalEvent.touches.length)
|
if (e.originalEvent.touches.length)
|
||||||
|
@ -288,6 +293,7 @@
|
||||||
touchDif = e.originalEvent.touches[0].pageY;
|
touchDif = e.originalEvent.touches[0].pageY;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// set up initial height
|
// set up initial height
|
||||||
getBarHeight();
|
getBarHeight();
|
||||||
|
@ -305,7 +311,9 @@
|
||||||
scrollContent($(o.start).position().top, null, true);
|
scrollContent($(o.start).position().top, null, true);
|
||||||
|
|
||||||
// make sure bar stays hidden
|
// make sure bar stays hidden
|
||||||
if (!o.alwaysVisible) { bar.hide(); }
|
if (!o.alwaysVisible) {
|
||||||
|
bar.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// attach scroll events
|
// attach scroll events
|
||||||
|
@ -314,13 +322,19 @@
|
||||||
function _onWheel(e)
|
function _onWheel(e)
|
||||||
{
|
{
|
||||||
// use mouse wheel only when mouse is over
|
// use mouse wheel only when mouse is over
|
||||||
if (!isOverPanel) { return; }
|
if (!isOverPanel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var e = e || window.event;
|
var e = e || window.event;
|
||||||
|
|
||||||
var delta = 0;
|
var delta = 0;
|
||||||
if (e.wheelDelta) { delta = -e.wheelDelta/120; }
|
if (e.wheelDelta) {
|
||||||
if (e.detail) { delta = e.detail / 3; }
|
delta = -e.wheelDelta / 120;
|
||||||
|
}
|
||||||
|
if (e.detail) {
|
||||||
|
delta = e.detail / 3;
|
||||||
|
}
|
||||||
|
|
||||||
var target = e.target || e.srcTarget || e.srcElement;
|
var target = e.target || e.srcTarget || e.srcElement;
|
||||||
if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
|
if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
|
||||||
|
@ -329,8 +343,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop window scroll
|
// stop window scroll
|
||||||
if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
|
if (e.preventDefault && !releaseScroll) {
|
||||||
if (!releaseScroll) { e.returnValue = false; }
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
if (!releaseScroll) {
|
||||||
|
e.returnValue = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollContent(y, isWheel, isJump)
|
function scrollContent(y, isWheel, isJump)
|
||||||
|
@ -438,7 +456,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bar.stop(true, true).fadeIn('fast');
|
bar.stop(true, true).fadeIn('fast');
|
||||||
if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
|
if (o.railVisible) {
|
||||||
|
rail.stop(true, true).fadeIn('fast');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideBar()
|
function hideBar()
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue