From 643a4a078f2c34348e79467002108836f217839e Mon Sep 17 00:00:00 2001 From: Asaf David Date: Tue, 4 Feb 2014 17:10:35 +0200 Subject: [PATCH] Fixed compatibility issues when jquery is included --- dist/ng-scrollbar.js | 2 +- dist/ng-scrollbar.min.js | 4 ++-- src/ng-scrollbar.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/ng-scrollbar.js b/dist/ng-scrollbar.js index 661f10c..08be35e 100644 --- a/dist/ng-scrollbar.js +++ b/dist/ng-scrollbar.js @@ -93,7 +93,7 @@ angular.module('ngScrollbar', []).directive('ngScrollbar', [ thumbLine.css(draggerLineStyle); track.bind('click', trackClick); var wheelEvent = win[0].onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; - transculdedContainer.bind(wheelEvent, wheelHandler); + transculdedContainer[0].addEventListener(wheelEvent, wheelHandler, false); thumb.bind('mousedown', function (event) { lastOffsetY = event.pageY - thumb[0].offsetTop; win.bind('mouseup', function () { diff --git a/dist/ng-scrollbar.min.js b/dist/ng-scrollbar.min.js index a13a69f..0cecb36 100644 --- a/dist/ng-scrollbar.min.js +++ b/dist/ng-scrollbar.min.js @@ -1,8 +1,8 @@ /** * ng-scrollbar - * @version v0.0.1 - 2014-01-18 + * @version v0.0.1 - 2014-02-04 * @link https://github.com/asafdav/ng-scrollbar * @author Asaf David <> * @license MIT License, http://www.opensource.org/licenses/MIT */ -"use strict";angular.module("ngScrollbar",[]).directive("ngScrollbar",["$parse","$window",function(a,b){return{restrict:"A",replace:!0,transclude:!0,link:function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q={top:0},r={top:0},s=function(){l={position:"relative",overflow:"hidden","max-width":"100%",height:"100%"},r.height&&(l.height=r.height+"px"),m={position:"absolute",height:q.height+"px",top:q.top+"px"},n={position:"relative","line-height":q.height+"px"},o={position:"relative",top:r.top+"px",overflow:"hidden"}},t=function(){i.css("top",q.top+"px");var a=q.top/r.height;r.top=-Math.round(r.scrollHeight*a),g.css("top",r.top+"px")},u=function(a){var b=a.hasOwnProperty("offsetY")?a.offsetY:a.layerY,c=Math.max(0,Math.min(parseInt(q.trackHeight,10)-parseInt(q.height,10),b));q.top=c,t(),a.stopPropagation()},v=function(a){var b=void 0!==a.wheelDeltaY?a.wheelDeltaY/20:void 0!==a.wheelDelta?a.wheelDelta/20:2*-a.detail;return q.top=Math.max(0,Math.min(parseInt(r.height,10)-parseInt(q.height,10),parseInt(q.top,10)-b)),t(),a.preventDefault?void a.preventDefault():!1},w=function(a,b,c){var d=Math.max(0,Math.min(parseInt(q.trackHeight,10)-parseInt(q.height,10),c));q.top=d,a.stopPropagation()},x=function(a){var b=a.pageY-i[0].scrollTop-p,c=0;w(a,c,b),t()},y=function(){if(e=angular.element(b),f=angular.element(c.children()[0]),g=angular.element(f.children()[0]),h=angular.element(f.children()[1]),i=angular.element(angular.element(h.children()[0]).children()[0]),j=angular.element(i.children()[0]),k=angular.element(angular.element(h.children()[0]).children()[1]),r.height=c[0].offsetHeight,r.scrollHeight=g[0].scrollHeight,r.height
'}}]); \ No newline at end of file +"use strict";angular.module("ngScrollbar",[]).directive("ngScrollbar",["$parse","$window",function(a,b){return{restrict:"A",replace:!0,transclude:!0,link:function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q={top:0},r={top:0},s=function(){l={position:"relative",overflow:"hidden","max-width":"100%",height:"100%"},r.height&&(l.height=r.height+"px"),m={position:"absolute",height:q.height+"px",top:q.top+"px"},n={position:"relative","line-height":q.height+"px"},o={position:"relative",top:r.top+"px",overflow:"hidden"}},t=function(){i.css("top",q.top+"px");var a=q.top/r.height;r.top=-Math.round(r.scrollHeight*a),g.css("top",r.top+"px")},u=function(a){var b=a.hasOwnProperty("offsetY")?a.offsetY:a.layerY,c=Math.max(0,Math.min(parseInt(q.trackHeight,10)-parseInt(q.height,10),b));q.top=c,t(),a.stopPropagation()},v=function(a){var b=void 0!==a.wheelDeltaY?a.wheelDeltaY/20:void 0!==a.wheelDelta?a.wheelDelta/20:2*-a.detail;return q.top=Math.max(0,Math.min(parseInt(r.height,10)-parseInt(q.height,10),parseInt(q.top,10)-b)),t(),a.preventDefault?void a.preventDefault():!1},w=function(a,b,c){var d=Math.max(0,Math.min(parseInt(q.trackHeight,10)-parseInt(q.height,10),c));q.top=d,a.stopPropagation()},x=function(a){var b=a.pageY-i[0].scrollTop-p,c=0;w(a,c,b),t()},y=function(){if(e=angular.element(b),f=angular.element(c.children()[0]),g=angular.element(f.children()[0]),h=angular.element(f.children()[1]),i=angular.element(angular.element(h.children()[0]).children()[0]),j=angular.element(i.children()[0]),k=angular.element(angular.element(h.children()[0]).children()[1]),r.height=c[0].offsetHeight,r.scrollHeight=g[0].scrollHeight,r.height
'}}]); \ No newline at end of file diff --git a/src/ng-scrollbar.js b/src/ng-scrollbar.js index 5a1bf39..c1553df 100644 --- a/src/ng-scrollbar.js +++ b/src/ng-scrollbar.js @@ -131,7 +131,8 @@ angular.module('ngScrollbar', []). // Handl mousewheel var wheelEvent = win[0].onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; - transculdedContainer.bind(wheelEvent, wheelHandler); + transculdedContainer[0].addEventListener(wheelEvent, wheelHandler, false); + // Drag the scroller thumb.bind('mousedown', function(event) {