diff --git a/bower.json b/bower.json index 2ee29af..39ad941 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "perfect-scrollbar", - "version": "0.5.5", + "version": "0.5.6", "homepage": "http://noraesae.github.io/perfect-scrollbar/", "authors": [ "Hyunje Alex Jun " diff --git a/min/perfect-scrollbar.min.css b/min/perfect-scrollbar.min.css index f221906..5fcbd93 100644 --- a/min/perfect-scrollbar.min.css +++ b/min/perfect-scrollbar.min.css @@ -1,5 +1,5 @@ -/*! perfect-scrollbar - v0.5.5 +/*! perfect-scrollbar - v0.5.6 * http://noraesae.github.com/perfect-scrollbar/ * Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */ -.ps-container>.ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover>.ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover>.ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999} \ No newline at end of file +.ps-container>.ps-scrollbar-x-rail{display:none;position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container.ps-active-x>.ps-scrollbar-x-rail{display:block}.ps-container:hover>.ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-y-rail{display:block;position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container.ps-active-y>.ps-scrollbar-y-rail{display:block}.ps-container:hover>.ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999} \ No newline at end of file diff --git a/min/perfect-scrollbar.min.js b/min/perfect-scrollbar.min.js index 27a033b..a319ddd 100644 --- a/min/perfect-scrollbar.min.js +++ b/min/perfect-scrollbar.min.js @@ -1,4 +1,4 @@ -/*! perfect-scrollbar - v0.5.5 +/*! perfect-scrollbar - v0.5.6 * http://noraesae.github.com/perfect-scrollbar/ * Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */ -(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";function o(e){return"string"==typeof e?parseInt(e,10):~~e}var t={wheelSpeed:1,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},n=function(){var e=0;return function(){var o=e;return e+=1,".perfect-scrollbar-"+o}}();e.fn.perfectScrollbar=function(r,l){return this.each(function(){function i(e,t){var n=e+t,r=P-k;C=0>n?0:n>r?r:n;var l=o(C*(x-P)/(P-k));L.scrollTop(l)}function a(e,t){var n=e+t,r=S-E;X=0>n?0:n>r?r:n;var l=o(X*(D-S)/(S-E));L.scrollLeft(l)}function s(e){return y.minScrollbarLength&&(e=Math.max(e,y.minScrollbarLength)),y.maxScrollbarLength&&(e=Math.min(e,y.maxScrollbarLength)),e}function c(){var e={width:S,display:M?"inherit":"none"};e.left=W?L.scrollLeft()+S-D:L.scrollLeft(),B?e.bottom=q-L.scrollTop():e.top=R+L.scrollTop(),K.css(e);var o={top:L.scrollTop(),height:P,display:Y?"inherit":"none"};z?o.right=W?D-L.scrollLeft()-Q-U.outerWidth():Q-L.scrollLeft():o.left=W?L.scrollLeft()+2*S-D-F-U.outerWidth():F+L.scrollLeft(),H.css(o),O.css({left:X,width:E-A}),U.css({top:C,height:k-G})}function d(){K.hide(),H.hide(),S=y.includePadding?L.innerWidth():L.width(),P=y.includePadding?L.innerHeight():L.height(),D=L.prop("scrollWidth"),x=L.prop("scrollHeight"),!y.suppressScrollX&&D>S+y.scrollXMarginOffset?(M=!0,E=s(o(S*S/D)),X=o(L.scrollLeft()*(S-E)/(D-S))):(M=!1,E=0,X=0,L.scrollLeft(0)),!y.suppressScrollY&&x>P+y.scrollYMarginOffset?(Y=!0,k=s(o(P*P/x)),C=o(L.scrollTop()*(P-k)/(x-P))):(Y=!1,k=0,C=0,L.scrollTop(0)),X>=S-E&&(X=S-E),C>=P-k&&(C=P-k),c(),M?L.addClass("ps-active-x"):L.removeClass("ps-active-x"),Y?L.addClass("ps-active-y"):L.removeClass("ps-active-y"),y.suppressScrollX||K.show(),y.suppressScrollY||H.show()}function p(){var o,t;O.bind("mousedown"+j,function(e){t=e.pageX,o=O.position().left,K.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(I).bind("mousemove"+j,function(e){K.hasClass("in-scrolling")&&(a(o,e.pageX-t),d(),e.stopPropagation(),e.preventDefault())}),e(I).bind("mouseup"+j,function(){K.hasClass("in-scrolling")&&K.removeClass("in-scrolling")}),o=t=null}function u(){var o,t;U.bind("mousedown"+j,function(e){t=e.pageY,o=U.position().top,H.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(I).bind("mousemove"+j,function(e){H.hasClass("in-scrolling")&&(i(o,e.pageY-t),d(),e.stopPropagation(),e.preventDefault())}),e(I).bind("mouseup"+j,function(){H.hasClass("in-scrolling")&&H.removeClass("in-scrolling")}),o=t=null}function f(e,o){var t=L.scrollTop();if(0===e){if(!Y)return!1;if(0===t&&o>0||t>=x-P&&0>o)return!y.wheelPropagation}var n=L.scrollLeft();if(0===o){if(!M)return!1;if(0===n&&0>e||n>=D-S&&e>0)return!y.wheelPropagation}return!0}function v(){function e(e){var o=e.originalEvent.deltaX,t=-1*e.originalEvent.deltaY;return(o===void 0||t===void 0)&&(o=-1*e.originalEvent.wheelDeltaX/6,t=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(o*=10,t*=10),o!==o&&t!==t&&(o=0,t=e.originalEvent.wheelDelta),[o,t]}function o(o){var n=e(o),r=n[0],l=n[1];t=!1,y.useBothWheelAxes?Y&&!M?(l?L.scrollTop(L.scrollTop()-l*y.wheelSpeed):L.scrollTop(L.scrollTop()+r*y.wheelSpeed),t=!0):M&&!Y&&(r?L.scrollLeft(L.scrollLeft()+r*y.wheelSpeed):L.scrollLeft(L.scrollLeft()-l*y.wheelSpeed),t=!0):(L.scrollTop(L.scrollTop()-l*y.wheelSpeed),L.scrollLeft(L.scrollLeft()+r*y.wheelSpeed)),d(),t=t||f(r,l),t&&(o.stopPropagation(),o.preventDefault())}var t=!1;window.onwheel!==void 0?L.bind("wheel"+j,o):window.onmousewheel!==void 0&&L.bind("mousewheel"+j,o)}function h(){var o=!1;L.bind("mouseenter"+j,function(){o=!0}),L.bind("mouseleave"+j,function(){o=!1});var t=!1;e(I).bind("keydown"+j,function(n){if((!n.isDefaultPrevented||!n.isDefaultPrevented())&&o){for(var r=document.activeElement?document.activeElement:I.activeElement;r.shadowRoot;)r=r.shadowRoot.activeElement;if(!e(r).is(":input,[contenteditable]")){var l=0,i=0;switch(n.which){case 37:l=-30;break;case 38:i=30;break;case 39:l=30;break;case 40:i=-30;break;case 33:i=90;break;case 32:case 34:i=-90;break;case 35:i=n.ctrlKey?-x:-P;break;case 36:i=n.ctrlKey?L.scrollTop():P;break;default:return}L.scrollTop(L.scrollTop()-i),L.scrollLeft(L.scrollLeft()+l),t=f(l,i),t&&n.preventDefault()}}})}function b(){function e(e){e.stopPropagation()}U.bind("click"+j,e),H.bind("click"+j,function(e){var t=o(k/2),n=e.pageY-H.offset().top-t,r=P-k,l=n/r;0>l?l=0:l>1&&(l=1),L.scrollTop((x-P)*l)}),O.bind("click"+j,e),K.bind("click"+j,function(e){var t=o(E/2),n=e.pageX-K.offset().left-t,r=S-E,l=n/r;0>l?l=0:l>1&&(l=1),L.scrollLeft((D-S)*l)})}function g(o,t){function n(e,o){L.scrollTop(L.scrollTop()-o),L.scrollLeft(L.scrollLeft()-e),d()}function r(){b=!0}function l(){b=!1}function i(e){return e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e.originalEvent}function a(e){var o=e.originalEvent;return o.targetTouches&&1===o.targetTouches.length?!0:o.pointerType&&"mouse"!==o.pointerType?!0:!1}function s(e){if(a(e)){g=!0;var o=i(e);u.pageX=o.pageX,u.pageY=o.pageY,f=(new Date).getTime(),null!==h&&clearInterval(h),e.stopPropagation(),e.preventDefault()}}function c(e){if(!b&&g&&a(e)){var o=i(e),t={pageX:o.pageX,pageY:o.pageY},r=t.pageX-u.pageX,l=t.pageY-u.pageY;n(r,l),u=t;var s=(new Date).getTime(),c=s-f;c>0&&(v.x=r/c,v.y=l/c,f=s),e.stopPropagation(),e.preventDefault()}}function p(){!b&&g&&(g=!1,clearInterval(h),h=setInterval(function(){return.01>Math.abs(v.x)&&.01>Math.abs(v.y)?(clearInterval(h),void 0):(n(30*v.x,30*v.y),v.x*=.8,v.y*=.8,void 0)},10))}var u={},f=0,v={},h=null,b=!1,g=!1;o&&(e(window).bind("touchstart"+j,r),e(window).bind("touchend"+j,l),L.bind("touchstart"+j,s),L.bind("touchmove"+j,c),L.bind("touchend"+j,p)),t&&(window.PointerEvent?(e(window).bind("pointerdown"+j,r),e(window).bind("pointerup"+j,l),L.bind("pointerdown"+j,s),L.bind("pointermove"+j,c),L.bind("pointerup"+j,p)):window.MSPointerEvent&&(e(window).bind("MSPointerDown"+j,r),e(window).bind("MSPointerUp"+j,l),L.bind("MSPointerDown"+j,s),L.bind("MSPointerMove"+j,c),L.bind("MSPointerUp"+j,p)))}function w(){L.bind("scroll"+j,function(){d()})}function m(){L.unbind(j),e(window).unbind(j),e(I).unbind(j),L.data("perfect-scrollbar",null),L.data("perfect-scrollbar-update",null),L.data("perfect-scrollbar-destroy",null),O.remove(),U.remove(),K.remove(),H.remove(),K=H=O=U=M=Y=S=P=D=x=E=X=q=B=R=k=C=Q=z=F=W=j=null}function T(){d(),w(),p(),u(),b(),v(),(J||N)&&g(J,N),y.useKeyboard&&h(),L.data("perfect-scrollbar",L),L.data("perfect-scrollbar-update",d),L.data("perfect-scrollbar-destroy",m)}var y=e.extend(!0,{},t),L=e(this);if("object"==typeof r?e.extend(!0,y,r):l=r,"update"===l)return L.data("perfect-scrollbar-update")&&L.data("perfect-scrollbar-update")(),L;if("destroy"===l)return L.data("perfect-scrollbar-destroy")&&L.data("perfect-scrollbar-destroy")(),L;if(L.data("perfect-scrollbar"))return L.data("perfect-scrollbar");L.addClass("ps-container");var S,P,D,x,M,E,X,Y,k,C,W="rtl"===L.css("direction"),j=n(),I=this.ownerDocument||document,K=e("
").appendTo(L),O=e("
").appendTo(K),q=o(K.css("bottom")),B=q===q,R=B?null:o(K.css("top")),A=o(K.css("borderLeftWidth"))+o(K.css("borderRightWidth")),H=e("
").appendTo(L),U=e("
").appendTo(H),Q=o(H.css("right")),z=Q===Q,F=z?null:o(H.css("left")),G=o(H.css("borderTopWidth"))+o(H.css("borderBottomWidth")),J="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,N=null!==window.navigator.msMaxTouchPoints;return T(),L})}}); \ No newline at end of file +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";function t(e){return"string"==typeof e?parseInt(e,10):~~e}var o={wheelSpeed:1,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},n=0,r=function(){var e=n++;return function(t){var o=".perfect-scrollbar-"+e;return t===void 0?o:t+o}};e.fn.perfectScrollbar=function(n,l){return this.each(function(){function i(e,o){var n=e+o,r=x-k;W=0>n?0:n>r?r:n;var l=t(W*(C-x)/(x-k));S.scrollTop(l)}function a(e,o){var n=e+o,r=P-E;X=0>n?0:n>r?r:n;var l=t(X*(D-P)/(P-E));S.scrollLeft(l)}function c(e){return L.minScrollbarLength&&(e=Math.max(e,L.minScrollbarLength)),L.maxScrollbarLength&&(e=Math.min(e,L.maxScrollbarLength)),e}function s(){var e={width:P,display:M?"inherit":"none"};e.left=I?S.scrollLeft()+P-D:S.scrollLeft(),q?e.bottom=R-S.scrollTop():e.top=B+S.scrollTop(),K.css(e);var t={top:S.scrollTop(),height:x,display:Y?"inherit":"none"};F?t.right=I?D-S.scrollLeft()-z-Q.outerWidth():z-S.scrollLeft():t.left=I?S.scrollLeft()+2*P-D-G-Q.outerWidth():G+S.scrollLeft(),U.css(t),O.css({left:X,width:E-H}),Q.css({top:W,height:k-J})}function d(){S.removeClass("ps-active-x"),S.removeClass("ps-active-y"),P=L.includePadding?S.innerWidth():S.width(),x=L.includePadding?S.innerHeight():S.height(),D=S.prop("scrollWidth"),C=S.prop("scrollHeight"),!L.suppressScrollX&&D>P+L.scrollXMarginOffset?(M=!0,E=c(t(P*P/D)),X=t(S.scrollLeft()*(P-E)/(D-P))):(M=!1,E=0,X=0,S.scrollLeft(0)),!L.suppressScrollY&&C>x+L.scrollYMarginOffset?(Y=!0,k=c(t(x*x/C)),W=t(S.scrollTop()*(x-k)/(C-x))):(Y=!1,k=0,W=0,S.scrollTop(0)),X>=P-E&&(X=P-E),W>=x-k&&(W=x-k),s(),M&&S.addClass("ps-active-x"),Y&&S.addClass("ps-active-y")}function u(){var t,o,n=!1;O.bind(j("mousedown"),function(e){o=e.pageX,t=O.position().left,K.addClass("in-scrolling"),n=!0,e.stopPropagation(),e.preventDefault()}),e(A).bind(j("mousemove"),function(e){n&&(a(t,e.pageX-o),d(),e.stopPropagation(),e.preventDefault())}),e(A).bind(j("mouseup"),function(){n&&(n=!1,K.removeClass("in-scrolling"))}),t=o=null}function p(){var t,o,n=!1;Q.bind(j("mousedown"),function(e){o=e.pageY,t=Q.position().top,n=!0,U.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(A).bind(j("mousemove"),function(e){n&&(i(t,e.pageY-o),d(),e.stopPropagation(),e.preventDefault())}),e(A).bind(j("mouseup"),function(){n&&(n=!1,U.removeClass("in-scrolling"))}),t=o=null}function f(e,t){var o=S.scrollTop();if(0===e){if(!Y)return!1;if(0===o&&t>0||o>=C-x&&0>t)return!L.wheelPropagation}var n=S.scrollLeft();if(0===t){if(!M)return!1;if(0===n&&0>e||n>=D-P&&e>0)return!L.wheelPropagation}return!0}function v(){function e(e){var t=e.originalEvent.deltaX,o=-1*e.originalEvent.deltaY;return(t===void 0||o===void 0)&&(t=-1*e.originalEvent.wheelDeltaX/6,o=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(t*=10,o*=10),t!==t&&o!==o&&(t=0,o=e.originalEvent.wheelDelta),[t,o]}function t(t){var n=e(t),r=n[0],l=n[1];o=!1,L.useBothWheelAxes?Y&&!M?(l?S.scrollTop(S.scrollTop()-l*L.wheelSpeed):S.scrollTop(S.scrollTop()+r*L.wheelSpeed),o=!0):M&&!Y&&(r?S.scrollLeft(S.scrollLeft()+r*L.wheelSpeed):S.scrollLeft(S.scrollLeft()-l*L.wheelSpeed),o=!0):(S.scrollTop(S.scrollTop()-l*L.wheelSpeed),S.scrollLeft(S.scrollLeft()+r*L.wheelSpeed)),d(),o=o||f(r,l),o&&(t.stopPropagation(),t.preventDefault())}var o=!1;window.onwheel!==void 0?S.bind(j("wheel"),t):window.onmousewheel!==void 0&&S.bind(j("mousewheel"),t)}function g(){var t=!1;S.bind(j("mouseenter"),function(){t=!0}),S.bind(j("mouseleave"),function(){t=!1});var o=!1;e(A).bind(j("keydown"),function(n){if((!n.isDefaultPrevented||!n.isDefaultPrevented())&&t){for(var r=document.activeElement?document.activeElement:A.activeElement;r.shadowRoot;)r=r.shadowRoot.activeElement;if(!e(r).is(":input,[contenteditable]")){var l=0,i=0;switch(n.which){case 37:l=-30;break;case 38:i=30;break;case 39:l=30;break;case 40:i=-30;break;case 33:i=90;break;case 32:case 34:i=-90;break;case 35:i=n.ctrlKey?-C:-x;break;case 36:i=n.ctrlKey?S.scrollTop():x;break;default:return}S.scrollTop(S.scrollTop()-i),S.scrollLeft(S.scrollLeft()+l),o=f(l,i),o&&n.preventDefault()}}})}function b(){function e(e){e.stopPropagation()}Q.bind(j("click"),e),U.bind(j("click"),function(e){var o=t(k/2),n=e.pageY-U.offset().top-o,r=x-k,l=n/r;0>l?l=0:l>1&&(l=1),S.scrollTop((C-x)*l)}),O.bind(j("click"),e),K.bind(j("click"),function(e){var o=t(E/2),n=e.pageX-K.offset().left-o,r=P-E,l=n/r;0>l?l=0:l>1&&(l=1),S.scrollLeft((D-P)*l)})}function h(){function t(){var e=window.getSelection?window.getSelection():document.getSlection?document.getSlection():{rangeCount:0};return 0===e.rangeCount?null:e.getRangeAt(0).commonAncestorContainer}function o(){r||(r=setInterval(function(){S.scrollTop(S.scrollTop()+l.top),S.scrollLeft(S.scrollLeft()+l.left),d()},50))}function n(){r&&(clearInterval(r),r=null),K.removeClass("in-scrolling"),U.removeClass("in-scrolling")}var r=null,l={top:0,left:0},i=!1;e(A).bind(j("selectionchange"),function(){e.contains(S[0],t())?i=!0:(i=!1,n())}),e(window).bind(j("mouseup"),function(){i&&(i=!1,n())}),e(window).bind(j("mousemove"),function(e){if(i){var t={x:e.pageX,y:e.pageY},r=S.offset(),a={left:r.left,right:r.left+S.outerWidth(),top:r.top,bottom:r.top+S.outerHeight()};t.xa.right-3?(l.left=5,K.addClass("in-scrolling")):l.left=0,t.ya.top+3-t.y?-5:-20,U.addClass("in-scrolling")):t.y>a.bottom-3?(l.top=5>t.y-a.bottom+3?5:20,U.addClass("in-scrolling")):l.top=0,0===l.top&&0===l.left?n():o()}})}function w(t,o){function n(e,t){S.scrollTop(S.scrollTop()-t),S.scrollLeft(S.scrollLeft()-e),d()}function r(){b=!0}function l(){b=!1}function i(e){return e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e.originalEvent}function a(e){var t=e.originalEvent;return t.targetTouches&&1===t.targetTouches.length?!0:t.pointerType&&"mouse"!==t.pointerType?!0:!1}function c(e){if(a(e)){h=!0;var t=i(e);p.pageX=t.pageX,p.pageY=t.pageY,f=(new Date).getTime(),null!==g&&clearInterval(g),e.stopPropagation()}}function s(e){if(!b&&h&&a(e)){var t=i(e),o={pageX:t.pageX,pageY:t.pageY},r=o.pageX-p.pageX,l=o.pageY-p.pageY;n(r,l),p=o;var c=(new Date).getTime(),s=c-f;s>0&&(v.x=r/s,v.y=l/s,f=c),e.stopPropagation(),e.preventDefault()}}function u(){!b&&h&&(h=!1,clearInterval(g),g=setInterval(function(){return.01>Math.abs(v.x)&&.01>Math.abs(v.y)?(clearInterval(g),void 0):(n(30*v.x,30*v.y),v.x*=.8,v.y*=.8,void 0)},10))}var p={},f=0,v={},g=null,b=!1,h=!1;t&&(e(window).bind(j("touchstart"),r),e(window).bind(j("touchend"),l),S.bind(j("touchstart"),c),S.bind(j("touchmove"),s),S.bind(j("touchend"),u)),o&&(window.PointerEvent?(e(window).bind(j("pointerdown"),r),e(window).bind(j("pointerup"),l),S.bind(j("pointerdown"),c),S.bind(j("pointermove"),s),S.bind(j("pointerup"),u)):window.MSPointerEvent&&(e(window).bind(j("MSPointerDown"),r),e(window).bind(j("MSPointerUp"),l),S.bind(j("MSPointerDown"),c),S.bind(j("MSPointerMove"),s),S.bind(j("MSPointerUp"),u)))}function m(){S.bind(j("scroll"),function(){d()})}function T(){S.unbind(j()),e(window).unbind(j()),e(A).unbind(j()),S.data("perfect-scrollbar",null),S.data("perfect-scrollbar-update",null),S.data("perfect-scrollbar-destroy",null),O.remove(),Q.remove(),K.remove(),U.remove(),K=U=O=Q=M=Y=P=x=D=C=E=X=R=q=B=k=W=z=F=G=I=j=null}function y(){d(),m(),u(),p(),b(),h(),v(),(N||V)&&w(N,V),L.useKeyboard&&g(),S.data("perfect-scrollbar",S),S.data("perfect-scrollbar-update",d),S.data("perfect-scrollbar-destroy",T)}var L=e.extend(!0,{},o),S=e(this);if("object"==typeof n?e.extend(!0,L,n):l=n,"update"===l)return S.data("perfect-scrollbar-update")&&S.data("perfect-scrollbar-update")(),S;if("destroy"===l)return S.data("perfect-scrollbar-destroy")&&S.data("perfect-scrollbar-destroy")(),S;if(S.data("perfect-scrollbar"))return S.data("perfect-scrollbar");S.addClass("ps-container");var P,x,D,C,M,E,X,Y,k,W,I="rtl"===S.css("direction"),j=r(),A=this.ownerDocument||document,K=e("
").appendTo(S),O=e("
").appendTo(K),R=t(K.css("bottom")),q=R===R,B=q?null:t(K.css("top")),H=t(K.css("borderLeftWidth"))+t(K.css("borderRightWidth")),U=e("
").appendTo(S),Q=e("
").appendTo(U),z=t(U.css("right")),F=z===z,G=F?null:t(U.css("left")),J=t(U.css("borderTopWidth"))+t(U.css("borderBottomWidth")),N="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,V=null!==window.navigator.msMaxTouchPoints;return y(),S})}}); \ No newline at end of file diff --git a/package.json b/package.json index a0dfd41..98b30e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perfect-scrollbar", - "version": "0.5.5", + "version": "0.5.6", "description": "Tiny but perfect jquery scrollbar plugin.", "author": "Hyunje Alex Jun ", "contributors": [{ diff --git a/perfect-scrollbar.jquery.json b/perfect-scrollbar.jquery.json index 4fd5316..fa6c4d0 100644 --- a/perfect-scrollbar.jquery.json +++ b/perfect-scrollbar.jquery.json @@ -2,7 +2,7 @@ "name": "perfect-scrollbar", "title": "perfect-scrollbar", "description": "Tiny but perfect jquery scrollbar plugin.", - "version": "0.5.5", + "version": "0.5.6", "author": { "name": "Hyunje Alex Jun", "email": "me@noraesae.net",