From ad0e1e4fabb39faad75c47405b9d2ac1dfb0d9c1 Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Mon, 30 Sep 2013 23:37:59 +0900 Subject: [PATCH] Release 0.4.5. Patch notes 1. AMD compatibility. 2. Add 'useBothWheelAxes' feature. 3. Implement keyboard scrolling. 4. Implement visible rails. --- min/perfect-scrollbar-0.4.4.min.css | 5 ----- min/perfect-scrollbar-0.4.4.min.js | 4 ---- min/perfect-scrollbar-0.4.4.with-mousewheel.min.js | 4 ---- min/perfect-scrollbar-0.4.5.min.css | 5 +++++ min/perfect-scrollbar-0.4.5.min.js | 4 ++++ min/perfect-scrollbar-0.4.5.with-mousewheel.min.js | 4 ++++ package.json | 2 +- perfect-scrollbar.jquery.json | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 min/perfect-scrollbar-0.4.4.min.css delete mode 100644 min/perfect-scrollbar-0.4.4.min.js delete mode 100644 min/perfect-scrollbar-0.4.4.with-mousewheel.min.js create mode 100644 min/perfect-scrollbar-0.4.5.min.css create mode 100644 min/perfect-scrollbar-0.4.5.min.js create mode 100644 min/perfect-scrollbar-0.4.5.with-mousewheel.min.js diff --git a/min/perfect-scrollbar-0.4.4.min.css b/min/perfect-scrollbar-0.4.4.min.css deleted file mode 100644 index fc067e2..0000000 --- a/min/perfect-scrollbar-0.4.4.min.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! perfect-scrollbar - v0.4.4 -* http://noraesae.github.com/perfect-scrollbar/ -* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */ - -.ps-container .ps-scrollbar-x{position:absolute;bottom:3px;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:opacity .2s linear;-webkit-transition:opacity.2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ps-container.ie6 .ps-scrollbar-x{font-size:0}.ps-container:hover .ps-scrollbar-x,.ps-container.hover .ps-scrollbar-x{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x:hover,.ps-container .ps-scrollbar-x.hover{opacity:.9;filter:alpha(opacity=90);cursor:default}.ps-container .ps-scrollbar-x.in-scrolling{opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y{position:absolute;right:3px;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:opacity .2s linear;-webkit-transition:opacity.2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ps-container.ie .ps-scrollbar-y{font-size:0}.ps-container:hover .ps-scrollbar-y,.ps-container.hover .ps-scrollbar-y{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y:hover,.ps-container .ps-scrollbar-y.hover{opacity:.9;filter:alpha(opacity=90);cursor:default}.ps-container .ps-scrollbar-y.in-scrolling{opacity:.9;filter:alpha(opacity=90)} \ No newline at end of file diff --git a/min/perfect-scrollbar-0.4.4.min.js b/min/perfect-scrollbar-0.4.4.min.js deleted file mode 100644 index 7ccf677..0000000 --- a/min/perfect-scrollbar-0.4.4.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! perfect-scrollbar - v0.4.4 -* http://noraesae.github.com/perfect-scrollbar/ -* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */ -"use strict";(function(e){var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null};e.fn.perfectScrollbar=function(o,r){return this.each(function(){var l=e.extend(!0,{},t),n=e(this);if("object"==typeof o?e.extend(!0,l,o):r=o,"update"===r)return n.data("perfect-scrollbar-update")&&n.data("perfect-scrollbar-update")(),n;if("destroy"===r)return n.data("perfect-scrollbar-destroy")&&n.data("perfect-scrollbar-destroy")(),n;if(n.data("perfect-scrollbar"))return n.data("perfect-scrollbar");n.addClass("ps-container");var c,s,a,i,p,u,f,d,h=e("
").appendTo(n),g=e("
").appendTo(n),v=parseInt(h.css("bottom"),10),b=parseInt(g.css("right"),10),m=function(){var e=parseInt(d*(i-s)/(s-f),10);n.scrollTop(e),h.css({bottom:v-e})},w=function(){var e=parseInt(u*(a-c)/(c-p),10);n.scrollLeft(e),g.css({right:b-e})},T=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),e},L=function(){h.css({left:u+n.scrollLeft(),bottom:v-n.scrollTop(),width:p}),g.css({top:d+n.scrollTop(),right:b-n.scrollLeft(),height:f})},I=function(){c=n.width(),s=n.height(),a=n.prop("scrollWidth"),i=n.prop("scrollHeight"),a>c?(p=T(parseInt(c*c/a,10)),u=parseInt(n.scrollLeft()*(c-p)/(a-c),10)):(p=0,u=0,n.scrollLeft(0)),i>s?(f=T(parseInt(s*s/i,10)),d=parseInt(n.scrollTop()*(s-f)/(i-s),10)):(f=0,d=0,n.scrollTop(0)),d>=s-f&&(d=s-f),u>=c-p&&(u=c-p),L()},C=function(e,t){var o=e+t,r=c-p;u=0>o?0:o>r?r:o,h.css({left:u+n.scrollLeft()})},y=function(e,t){var o=e+t,r=s-f;d=0>o?0:o>r?r:o,g.css({top:d+n.scrollTop()})},D=function(){var t,o;h.bind("mousedown.perfect-scroll",function(e){o=e.pageX,t=h.position().left,h.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scroll",function(e){h.hasClass("in-scrolling")&&(w(),C(t,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scroll",function(){h.hasClass("in-scrolling")&&h.removeClass("in-scrolling")}),t=o=null},P=function(){var t,o;g.bind("mousedown.perfect-scroll",function(e){o=e.pageY,t=g.position().top,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scroll",function(e){g.hasClass("in-scrolling")&&(m(),y(t,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scroll",function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),t=o=null},x=function(){var e=function(e,t){var o=n.scrollTop();if(0===o&&t>0&&0===e)return!l.wheelPropagation;if(o>=i-s&&0>t&&0===e)return!l.wheelPropagation;var r=n.scrollLeft();return 0===r&&0>e&&0===t?!l.wheelPropagation:r>=a-c&&e>0&&0===t?!l.wheelPropagation:!0},t=!1;n.bind("mousewheel.perfect-scroll",function(o,r,c,s){n.scrollTop(n.scrollTop()-s*l.wheelSpeed),n.scrollLeft(n.scrollLeft()+c*l.wheelSpeed),I(),t=e(c,s),t&&o.preventDefault()}),n.bind("MozMousePixelScroll.perfect-scroll",function(e){t&&e.preventDefault()})},S=function(){var t=function(e,t){n.scrollTop(n.scrollTop()-t),n.scrollLeft(n.scrollLeft()-e),I()},o={},r=0,l={},c=null,s=!1;e(window).bind("touchstart.perfect-scroll",function(){s=!0}),e(window).bind("touchend.perfect-scroll",function(){s=!1}),n.bind("touchstart.perfect-scroll",function(e){var t=e.originalEvent.targetTouches[0];o.pageX=t.pageX,o.pageY=t.pageY,r=(new Date).getTime(),null!==c&&clearInterval(c),e.stopPropagation()}),n.bind("touchmove.perfect-scroll",function(e){if(!s&&1===e.originalEvent.targetTouches.length){var n=e.originalEvent.targetTouches[0],c={};c.pageX=n.pageX,c.pageY=n.pageY;var a=c.pageX-o.pageX,i=c.pageY-o.pageY;t(a,i),o=c;var p=(new Date).getTime();l.x=a/(p-r),l.y=i/(p-r),r=p,e.preventDefault()}}),n.bind("touchend.perfect-scroll",function(){clearInterval(c),c=setInterval(function(){return.01>Math.abs(l.x)&&.01>Math.abs(l.y)?(clearInterval(c),void 0):(t(30*l.x,30*l.y),l.x*=.8,l.y*=.8,void 0)},10)})},X=function(){n.unbind(".perfect-scroll"),e(window).unbind(".perfect-scroll"),e(document).unbind(".perfect-scroll"),n.data("perfect-scrollbar",null),n.data("perfect-scrollbar-update",null),n.data("perfect-scrollbar-destroy",null),h.remove(),g.remove(),h=g=c=s=a=i=p=u=v=f=d=b=null},Y=function(t){n.addClass("ie").addClass("ie"+t);var o=function(){var t=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};n.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o),h.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o),g.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o)},r=function(){L=function(){h.css({left:u+n.scrollLeft(),bottom:v,width:p}),g.css({top:d+n.scrollTop(),right:b,height:f}),h.hide().show(),g.hide().show()},m=function(){var e=parseInt(d*i/s,10);n.scrollTop(e),h.css({bottom:v}),h.hide().show()},w=function(){var e=parseInt(u*a/c,10);n.scrollLeft(e),g.hide().show()}};6===t&&(o(),r())},M="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,E=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&Y(parseInt(e[2],10)),I(),D(),P(),M&&S(),n.mousewheel&&x(),n.data("perfect-scrollbar",n),n.data("perfect-scrollbar-update",I),n.data("perfect-scrollbar-destroy",X)};return E(),n})}})(jQuery); \ No newline at end of file diff --git a/min/perfect-scrollbar-0.4.4.with-mousewheel.min.js b/min/perfect-scrollbar-0.4.4.with-mousewheel.min.js deleted file mode 100644 index dae4bd1..0000000 --- a/min/perfect-scrollbar-0.4.4.with-mousewheel.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! perfect-scrollbar - v0.4.4 -* http://noraesae.github.com/perfect-scrollbar/ -* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */ -"use strict";(function(e){var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null};e.fn.perfectScrollbar=function(o,r){return this.each(function(){var n=e.extend(!0,{},t),l=e(this);if("object"==typeof o?e.extend(!0,n,o):r=o,"update"===r)return l.data("perfect-scrollbar-update")&&l.data("perfect-scrollbar-update")(),l;if("destroy"===r)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,c,a,i,p,u,f,d,h=e("
").appendTo(l),v=e("
").appendTo(l),g=parseInt(h.css("bottom"),10),m=parseInt(v.css("right"),10),b=function(){var e=parseInt(d*(i-c)/(c-f),10);l.scrollTop(e),h.css({bottom:g-e})},w=function(){var e=parseInt(u*(a-s)/(s-p),10);l.scrollLeft(e),v.css({right:m-e})},T=function(e){return n.minScrollbarLength&&(e=Math.max(e,n.minScrollbarLength)),e},L=function(){h.css({left:u+l.scrollLeft(),bottom:g-l.scrollTop(),width:p}),v.css({top:d+l.scrollTop(),right:m-l.scrollLeft(),height:f})},I=function(){s=l.width(),c=l.height(),a=l.prop("scrollWidth"),i=l.prop("scrollHeight"),a>s?(p=T(parseInt(s*s/a,10)),u=parseInt(l.scrollLeft()*(s-p)/(a-s),10)):(p=0,u=0,l.scrollLeft(0)),i>c?(f=T(parseInt(c*c/i,10)),d=parseInt(l.scrollTop()*(c-f)/(i-c),10)):(f=0,d=0,l.scrollTop(0)),d>=c-f&&(d=c-f),u>=s-p&&(u=s-p),L()},D=function(e,t){var o=e+t,r=s-p;u=0>o?0:o>r?r:o,h.css({left:u+l.scrollLeft()})},C=function(e,t){var o=e+t,r=c-f;d=0>o?0:o>r?r:o,v.css({top:d+l.scrollTop()})},y=function(){var t,o;h.bind("mousedown.perfect-scroll",function(e){o=e.pageX,t=h.position().left,h.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scroll",function(e){h.hasClass("in-scrolling")&&(w(),D(t,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scroll",function(){h.hasClass("in-scrolling")&&h.removeClass("in-scrolling")}),t=o=null},x=function(){var t,o;v.bind("mousedown.perfect-scroll",function(e){o=e.pageY,t=v.position().top,v.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scroll",function(e){v.hasClass("in-scrolling")&&(b(),C(t,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scroll",function(){v.hasClass("in-scrolling")&&v.removeClass("in-scrolling")}),t=o=null},P=function(){var e=function(e,t){var o=l.scrollTop();if(0===o&&t>0&&0===e)return!n.wheelPropagation;if(o>=i-c&&0>t&&0===e)return!n.wheelPropagation;var r=l.scrollLeft();return 0===r&&0>e&&0===t?!n.wheelPropagation:r>=a-s&&e>0&&0===t?!n.wheelPropagation:!0},t=!1;l.bind("mousewheel.perfect-scroll",function(o,r,s,c){l.scrollTop(l.scrollTop()-c*n.wheelSpeed),l.scrollLeft(l.scrollLeft()+s*n.wheelSpeed),I(),t=e(s,c),t&&o.preventDefault()}),l.bind("MozMousePixelScroll.perfect-scroll",function(e){t&&e.preventDefault()})},X=function(){var t=function(e,t){l.scrollTop(l.scrollTop()-t),l.scrollLeft(l.scrollLeft()-e),I()},o={},r=0,n={},s=null,c=!1;e(window).bind("touchstart.perfect-scroll",function(){c=!0}),e(window).bind("touchend.perfect-scroll",function(){c=!1}),l.bind("touchstart.perfect-scroll",function(e){var t=e.originalEvent.targetTouches[0];o.pageX=t.pageX,o.pageY=t.pageY,r=(new Date).getTime(),null!==s&&clearInterval(s),e.stopPropagation()}),l.bind("touchmove.perfect-scroll",function(e){if(!c&&1===e.originalEvent.targetTouches.length){var l=e.originalEvent.targetTouches[0],s={};s.pageX=l.pageX,s.pageY=l.pageY;var a=s.pageX-o.pageX,i=s.pageY-o.pageY;t(a,i),o=s;var p=(new Date).getTime();n.x=a/(p-r),n.y=i/(p-r),r=p,e.preventDefault()}}),l.bind("touchend.perfect-scroll",function(){clearInterval(s),s=setInterval(function(){return.01>Math.abs(n.x)&&.01>Math.abs(n.y)?(clearInterval(s),void 0):(t(30*n.x,30*n.y),n.x*=.8,n.y*=.8,void 0)},10)})},S=function(){l.unbind(".perfect-scroll"),e(window).unbind(".perfect-scroll"),e(document).unbind(".perfect-scroll"),l.data("perfect-scrollbar",null),l.data("perfect-scrollbar-update",null),l.data("perfect-scrollbar-destroy",null),h.remove(),v.remove(),h=v=s=c=a=i=p=u=g=f=d=m=null},Y=function(t){l.addClass("ie").addClass("ie"+t);var o=function(){var t=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};l.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o),h.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o),v.bind("mouseenter.perfect-scroll",t).bind("mouseleave.perfect-scroll",o)},r=function(){L=function(){h.css({left:u+l.scrollLeft(),bottom:g,width:p}),v.css({top:d+l.scrollTop(),right:m,height:f}),h.hide().show(),v.hide().show()},b=function(){var e=parseInt(d*i/c,10);l.scrollTop(e),h.css({bottom:g}),h.hide().show()},w=function(){var e=parseInt(u*a/s,10);l.scrollLeft(e),v.hide().show()}};6===t&&(o(),r())},M="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,E=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&Y(parseInt(e[2],10)),I(),y(),x(),M&&X(),l.mousewheel&&P(),l.data("perfect-scrollbar",l),l.data("perfect-scrollbar-update",I),l.data("perfect-scrollbar-destroy",S)};return E(),l})}})(jQuery),function(e){function t(t){var o=t||window.event,r=[].slice.call(arguments,1),n=0,l=0,s=0;return t=e.event.fix(o),t.type="mousewheel",o.wheelDelta&&(n=o.wheelDelta/120),o.detail&&(n=-o.detail/3),s=n,void 0!==o.axis&&o.axis===o.HORIZONTAL_AXIS&&(s=0,l=-1*n),void 0!==o.wheelDeltaY&&(s=o.wheelDeltaY/120),void 0!==o.wheelDeltaX&&(l=-1*o.wheelDeltaX/120),r.unshift(t,n,l,s),(e.event.dispatch||e.event.handle).apply(this,r)}var o=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var r=o.length;r;)e.event.fixHooks[o[--r]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=o.length;e;)this.addEventListener(o[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=o.length;e;)this.removeEventListener(o[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery); \ No newline at end of file diff --git a/min/perfect-scrollbar-0.4.5.min.css b/min/perfect-scrollbar-0.4.5.min.css new file mode 100644 index 0000000..5379a55 --- /dev/null +++ b/min/perfect-scrollbar-0.4.5.min.css @@ -0,0 +1,5 @@ +/*! perfect-scrollbar - v0.4.5 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2013 HyeonJe 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,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{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,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{opacity:.9;filter:alpha(opacity=90)}.ps-container .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.ie6 .ps-scrollbar-x{font-size:0}.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x{background-color:#999}.ps-container .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.ie .ps-scrollbar-y{font-size:0}.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,.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-0.4.5.min.js b/min/perfect-scrollbar-0.4.5.min.js new file mode 100644 index 0000000..98aba4a --- /dev/null +++ b/min/perfect-scrollbar-0.4.5.min.js @@ -0,0 +1,4 @@ +/*! perfect-scrollbar - v0.4.5 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */ +"use strict";(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var r={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0};e.fn.perfectScrollbar=function(o,t){return this.each(function(){var l=e.extend(!0,{},r),n=e(this);if("object"==typeof o?e.extend(!0,l,o):t=o,"update"===t)return n.data("perfect-scrollbar-update")&&n.data("perfect-scrollbar-update")(),n;if("destroy"===t)return n.data("perfect-scrollbar-destroy")&&n.data("perfect-scrollbar-destroy")(),n;if(n.data("perfect-scrollbar"))return n.data("perfect-scrollbar");n.addClass("ps-container");var c,s,a,i,p,f,u,d,b,h,v=e("
").appendTo(n),g=e("
").appendTo(n),m=e("
").appendTo(v),w=e("
").appendTo(g),T=parseInt(v.css("bottom"),10),L=parseInt(g.css("right"),10),y=function(){var e=parseInt(h*(f-i)/(i-b),10);n.scrollTop(e),v.css({bottom:T-e})},I=function(){var e=parseInt(d*(p-a)/(a-u),10);n.scrollLeft(e),g.css({right:L-e})},C=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),e},S=function(){v.css({left:n.scrollLeft(),bottom:T-n.scrollTop(),width:a}),g.css({top:n.scrollTop(),right:L-n.scrollLeft(),height:i}),m.css({left:d,width:u}),w.css({top:h,height:b})},x=function(){a=n.width(),i=n.height(),p=n.prop("scrollWidth"),f=n.prop("scrollHeight"),p>a?(c=!0,u=C(parseInt(a*a/p,10)),d=parseInt(n.scrollLeft()*(a-u)/(p-a),10)):(c=!1,u=0,d=0,n.scrollLeft(0)),f>i?(s=!0,b=C(parseInt(i*i/f,10)),h=parseInt(n.scrollTop()*(i-b)/(f-i),10)):(s=!1,b=0,h=0,n.scrollTop(0)),h>=i-b&&(h=i-b),d>=a-u&&(d=a-u),S()},D=function(e,r){var o=e+r,t=a-u;d=0>o?0:o>t?t:o,v.css({left:n.scrollLeft()}),m.css({left:d})},P=function(e,r){var o=e+r,t=i-b;h=0>o?0:o>t?t:o,g.css({top:n.scrollTop()}),w.css({top:h})},k=function(){var r,o;m.bind("mousedown.perfect-scrollbar",function(e){o=e.pageX,r=m.position().left,v.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scrollbar",function(e){v.hasClass("in-scrolling")&&(I(),D(r,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scrollbar",function(){v.hasClass("in-scrolling")&&v.removeClass("in-scrolling")}),r=o=null},X=function(){var r,o;w.bind("mousedown.perfect-scrollbar",function(e){o=e.pageY,r=w.position().top,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scrollbar",function(e){g.hasClass("in-scrolling")&&(y(),P(r,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scrollbar",function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),r=o=null},Y=function(){var e=function(e,r){var o=n.scrollTop();if(0===o&&r>0&&0===e)return!l.wheelPropagation;if(o>=f-i&&0>r&&0===e)return!l.wheelPropagation;var t=n.scrollLeft();return 0===t&&0>e&&0===r?!l.wheelPropagation:t>=p-a&&e>0&&0===r?!l.wheelPropagation:!0},r=!1;n.bind("mousewheel.perfect-scrollbar",function(o,t,a,i){l.useBothWheelAxes?s&&!c?i?n.scrollTop(n.scrollTop()-i*l.wheelSpeed):n.scrollTop(n.scrollTop()+a*l.wheelSpeed):c&&!s&&(a?n.scrollLeft(n.scrollLeft()+a*l.wheelSpeed):n.scrollLeft(n.scrollLeft()-i*l.wheelSpeed)):(n.scrollTop(n.scrollTop()-i*l.wheelSpeed),n.scrollLeft(n.scrollLeft()+a*l.wheelSpeed)),x(),r=e(a,i),r&&o.preventDefault()}),n.bind("MozMousePixelScroll.perfect-scrollbar",function(e){r&&e.preventDefault()})},M=function(){var r=function(e,r){var o=n.scrollTop();if(0===o&&r>0&&0===e)return!1;if(o>=f-i&&0>r&&0===e)return!1;var t=n.scrollLeft();return 0===t&&0>e&&0===r?!1:t>=p-a&&e>0&&0===r?!1:!0},o=!1;n.bind("mouseenter.perfect-scrollbar",function(){o=!0}),n.bind("mouseleave.perfect-scrollbar",function(){o=!1});var t=!1;e(document).bind("keydown.perfect-scrollbar",function(e){if(o){var c=0,s=0;switch(e.which){case 37:c=-3;break;case 38:s=3;break;case 39:c=3;break;case 40:s=-3;break;default:return}n.scrollTop(n.scrollTop()-s*l.wheelSpeed),n.scrollLeft(n.scrollLeft()+c*l.wheelSpeed),x(),t=r(c,s),t&&e.preventDefault()}})},j=function(){var e=function(e){e.stopPropagation()};w.bind("click.perfect-scrollbar",e),g.bind("click.perfect-scrollbar",function(e){var r=parseInt(b/2,10),o=e.pageY-g.offset().top-r,t=i-b,l=o/t;0>l?l=0:l>1&&(l=1),n.scrollTop((f-i)*l),x()}),m.bind("click.perfect-scrollbar",e),v.bind("click.perfect-scrollbar",function(e){var r=parseInt(u/2,10),o=e.pageX-v.offset().left-r,t=a-u,l=o/t;0>l?l=0:l>1&&(l=1),n.scrollLeft((p-a)*l),x()})},A=function(){var r=function(e,r){n.scrollTop(n.scrollTop()-r),n.scrollLeft(n.scrollLeft()-e),x()},o={},t=0,l={},c=null,s=!1;e(window).bind("touchstart.perfect-scrollbar",function(){s=!0}),e(window).bind("touchend.perfect-scrollbar",function(){s=!1}),n.bind("touchstart.perfect-scrollbar",function(e){var r=e.originalEvent.targetTouches[0];o.pageX=r.pageX,o.pageY=r.pageY,t=(new Date).getTime(),null!==c&&clearInterval(c),e.stopPropagation()}),n.bind("touchmove.perfect-scrollbar",function(e){if(!s&&1===e.originalEvent.targetTouches.length){var n=e.originalEvent.targetTouches[0],c={};c.pageX=n.pageX,c.pageY=n.pageY;var a=c.pageX-o.pageX,i=c.pageY-o.pageY;r(a,i),o=c;var p=(new Date).getTime();l.x=a/(p-t),l.y=i/(p-t),t=p,e.preventDefault()}}),n.bind("touchend.perfect-scrollbar",function(){clearInterval(c),c=setInterval(function(){return.01>Math.abs(l.x)&&.01>Math.abs(l.y)?(clearInterval(c),void 0):(r(30*l.x,30*l.y),l.x*=.8,l.y*=.8,void 0)},10)})},E=function(){n.unbind(".perfect-scrollbar"),e(window).unbind(".perfect-scrollbar"),e(document).unbind(".perfect-scrollbar"),n.data("perfect-scrollbar",null),n.data("perfect-scrollbar-update",null),n.data("perfect-scrollbar-destroy",null),m.remove(),w.remove(),v.remove(),g.remove(),m=w=a=i=p=f=u=d=T=b=h=L=null},W=function(r){n.addClass("ie").addClass("ie"+r);var o=function(){var r=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};n.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),v.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),g.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),m.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),w.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o)},t=function(){S=function(){m.css({left:d+n.scrollLeft(),bottom:T,width:u}),w.css({top:h+n.scrollTop(),right:L,height:b}),m.hide().show(),w.hide().show()},y=function(){var e=parseInt(h*f/i,10);n.scrollTop(e),m.css({bottom:T}),m.hide().show()},I=function(){var e=parseInt(d*p/a,10);n.scrollLeft(e),w.hide().show()}};6===r&&(o(),t())},B="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,K=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&W(parseInt(e[2],10)),x(),k(),X(),j(),B&&A(),n.mousewheel&&Y(),l.useKeyboard&&M(),n.data("perfect-scrollbar",n),n.data("perfect-scrollbar-update",x),n.data("perfect-scrollbar-destroy",E)};return K(),n})}}); \ No newline at end of file diff --git a/min/perfect-scrollbar-0.4.5.with-mousewheel.min.js b/min/perfect-scrollbar-0.4.5.with-mousewheel.min.js new file mode 100644 index 0000000..6cc738e --- /dev/null +++ b/min/perfect-scrollbar-0.4.5.with-mousewheel.min.js @@ -0,0 +1,4 @@ +/*! perfect-scrollbar - v0.4.5 +* http://noraesae.github.com/perfect-scrollbar/ +* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */ +"use strict";(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var r={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0};e.fn.perfectScrollbar=function(o,t){return this.each(function(){var l=e.extend(!0,{},r),n=e(this);if("object"==typeof o?e.extend(!0,l,o):t=o,"update"===t)return n.data("perfect-scrollbar-update")&&n.data("perfect-scrollbar-update")(),n;if("destroy"===t)return n.data("perfect-scrollbar-destroy")&&n.data("perfect-scrollbar-destroy")(),n;if(n.data("perfect-scrollbar"))return n.data("perfect-scrollbar");n.addClass("ps-container");var s,c,a,i,p,f,u,d,b,h,v=e("
").appendTo(n),g=e("
").appendTo(n),m=e("
").appendTo(v),w=e("
").appendTo(g),T=parseInt(v.css("bottom"),10),L=parseInt(g.css("right"),10),y=function(){var e=parseInt(h*(f-i)/(i-b),10);n.scrollTop(e),v.css({bottom:T-e})},I=function(){var e=parseInt(d*(p-a)/(a-u),10);n.scrollLeft(e),g.css({right:L-e})},D=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),e},S=function(){v.css({left:n.scrollLeft(),bottom:T-n.scrollTop(),width:a}),g.css({top:n.scrollTop(),right:L-n.scrollLeft(),height:i}),m.css({left:d,width:u}),w.css({top:h,height:b})},x=function(){a=n.width(),i=n.height(),p=n.prop("scrollWidth"),f=n.prop("scrollHeight"),p>a?(s=!0,u=D(parseInt(a*a/p,10)),d=parseInt(n.scrollLeft()*(a-u)/(p-a),10)):(s=!1,u=0,d=0,n.scrollLeft(0)),f>i?(c=!0,b=D(parseInt(i*i/f,10)),h=parseInt(n.scrollTop()*(i-b)/(f-i),10)):(c=!1,b=0,h=0,n.scrollTop(0)),h>=i-b&&(h=i-b),d>=a-u&&(d=a-u),S()},C=function(e,r){var o=e+r,t=a-u;d=0>o?0:o>t?t:o,v.css({left:n.scrollLeft()}),m.css({left:d})},P=function(e,r){var o=e+r,t=i-b;h=0>o?0:o>t?t:o,g.css({top:n.scrollTop()}),w.css({top:h})},k=function(){var r,o;m.bind("mousedown.perfect-scrollbar",function(e){o=e.pageX,r=m.position().left,v.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scrollbar",function(e){v.hasClass("in-scrolling")&&(I(),C(r,e.pageX-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scrollbar",function(){v.hasClass("in-scrolling")&&v.removeClass("in-scrolling")}),r=o=null},X=function(){var r,o;w.bind("mousedown.perfect-scrollbar",function(e){o=e.pageY,r=w.position().top,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove.perfect-scrollbar",function(e){g.hasClass("in-scrolling")&&(y(),P(r,e.pageY-o),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup.perfect-scrollbar",function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),r=o=null},Y=function(){var e=function(e,r){var o=n.scrollTop();if(0===o&&r>0&&0===e)return!l.wheelPropagation;if(o>=f-i&&0>r&&0===e)return!l.wheelPropagation;var t=n.scrollLeft();return 0===t&&0>e&&0===r?!l.wheelPropagation:t>=p-a&&e>0&&0===r?!l.wheelPropagation:!0},r=!1;n.bind("mousewheel.perfect-scrollbar",function(o,t,a,i){l.useBothWheelAxes?c&&!s?i?n.scrollTop(n.scrollTop()-i*l.wheelSpeed):n.scrollTop(n.scrollTop()+a*l.wheelSpeed):s&&!c&&(a?n.scrollLeft(n.scrollLeft()+a*l.wheelSpeed):n.scrollLeft(n.scrollLeft()-i*l.wheelSpeed)):(n.scrollTop(n.scrollTop()-i*l.wheelSpeed),n.scrollLeft(n.scrollLeft()+a*l.wheelSpeed)),x(),r=e(a,i),r&&o.preventDefault()}),n.bind("MozMousePixelScroll.perfect-scrollbar",function(e){r&&e.preventDefault()})},M=function(){var r=function(e,r){var o=n.scrollTop();if(0===o&&r>0&&0===e)return!1;if(o>=f-i&&0>r&&0===e)return!1;var t=n.scrollLeft();return 0===t&&0>e&&0===r?!1:t>=p-a&&e>0&&0===r?!1:!0},o=!1;n.bind("mouseenter.perfect-scrollbar",function(){o=!0}),n.bind("mouseleave.perfect-scrollbar",function(){o=!1});var t=!1;e(document).bind("keydown.perfect-scrollbar",function(e){if(o){var s=0,c=0;switch(e.which){case 37:s=-3;break;case 38:c=3;break;case 39:s=3;break;case 40:c=-3;break;default:return}n.scrollTop(n.scrollTop()-c*l.wheelSpeed),n.scrollLeft(n.scrollLeft()+s*l.wheelSpeed),x(),t=r(s,c),t&&e.preventDefault()}})},E=function(){var e=function(e){e.stopPropagation()};w.bind("click.perfect-scrollbar",e),g.bind("click.perfect-scrollbar",function(e){var r=parseInt(b/2,10),o=e.pageY-g.offset().top-r,t=i-b,l=o/t;0>l?l=0:l>1&&(l=1),n.scrollTop((f-i)*l),x()}),m.bind("click.perfect-scrollbar",e),v.bind("click.perfect-scrollbar",function(e){var r=parseInt(u/2,10),o=e.pageX-v.offset().left-r,t=a-u,l=o/t;0>l?l=0:l>1&&(l=1),n.scrollLeft((p-a)*l),x()})},A=function(){var r=function(e,r){n.scrollTop(n.scrollTop()-r),n.scrollLeft(n.scrollLeft()-e),x()},o={},t=0,l={},s=null,c=!1;e(window).bind("touchstart.perfect-scrollbar",function(){c=!0}),e(window).bind("touchend.perfect-scrollbar",function(){c=!1}),n.bind("touchstart.perfect-scrollbar",function(e){var r=e.originalEvent.targetTouches[0];o.pageX=r.pageX,o.pageY=r.pageY,t=(new Date).getTime(),null!==s&&clearInterval(s),e.stopPropagation()}),n.bind("touchmove.perfect-scrollbar",function(e){if(!c&&1===e.originalEvent.targetTouches.length){var n=e.originalEvent.targetTouches[0],s={};s.pageX=n.pageX,s.pageY=n.pageY;var a=s.pageX-o.pageX,i=s.pageY-o.pageY;r(a,i),o=s;var p=(new Date).getTime();l.x=a/(p-t),l.y=i/(p-t),t=p,e.preventDefault()}}),n.bind("touchend.perfect-scrollbar",function(){clearInterval(s),s=setInterval(function(){return.01>Math.abs(l.x)&&.01>Math.abs(l.y)?(clearInterval(s),void 0):(r(30*l.x,30*l.y),l.x*=.8,l.y*=.8,void 0)},10)})},j=function(){n.unbind(".perfect-scrollbar"),e(window).unbind(".perfect-scrollbar"),e(document).unbind(".perfect-scrollbar"),n.data("perfect-scrollbar",null),n.data("perfect-scrollbar-update",null),n.data("perfect-scrollbar-destroy",null),m.remove(),w.remove(),v.remove(),g.remove(),m=w=a=i=p=f=u=d=T=b=h=L=null},W=function(r){n.addClass("ie").addClass("ie"+r);var o=function(){var r=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};n.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),v.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),g.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),m.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o),w.bind("mouseenter.perfect-scrollbar",r).bind("mouseleave.perfect-scrollbar",o)},t=function(){S=function(){m.css({left:d+n.scrollLeft(),bottom:T,width:u}),w.css({top:h+n.scrollTop(),right:L,height:b}),m.hide().show(),w.hide().show()},y=function(){var e=parseInt(h*f/i,10);n.scrollTop(e),m.css({bottom:T}),m.hide().show()},I=function(){var e=parseInt(d*p/a,10);n.scrollLeft(e),w.hide().show()}};6===r&&(o(),t())},H="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,B=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&W(parseInt(e[2],10)),x(),k(),X(),E(),H&&A(),n.mousewheel&&Y(),l.useKeyboard&&M(),n.data("perfect-scrollbar",n),n.data("perfect-scrollbar-update",x),n.data("perfect-scrollbar-destroy",j)};return B(),n})}}),function(e){function r(r){var o=r||window.event,t=[].slice.call(arguments,1),l=0,n=0,s=0;return r=e.event.fix(o),r.type="mousewheel",o.wheelDelta&&(l=o.wheelDelta/120),o.detail&&(l=-o.detail/3),s=l,void 0!==o.axis&&o.axis===o.HORIZONTAL_AXIS&&(s=0,n=-1*l),void 0!==o.wheelDeltaY&&(s=o.wheelDeltaY/120),void 0!==o.wheelDeltaX&&(n=-1*o.wheelDeltaX/120),t.unshift(r,l,n,s),(e.event.dispatch||e.event.handle).apply(this,t)}var o=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var t=o.length;t;)e.event.fixHooks[o[--t]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=o.length;e;)this.addEventListener(o[--e],r,!1);else this.onmousewheel=r},teardown:function(){if(this.removeEventListener)for(var e=o.length;e;)this.removeEventListener(o[--e],r,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index 1dd84b1..9da45d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perfect-scrollbar", - "version": "0.4.4", + "version": "0.4.5", "engines": { "node": ">= 0.8.0" }, diff --git a/perfect-scrollbar.jquery.json b/perfect-scrollbar.jquery.json index 48794a8..09abeb6 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.4.4", + "version": "0.4.5", "author": { "name": "HyeonJe Jun", "email": "noraesae@yuiazu.net",