From 4482b47f716b5099352ac891427e2e6f7412347f Mon Sep 17 00:00:00 2001 From: supersnager Date: Sun, 17 Jan 2016 16:57:51 +0100 Subject: [PATCH 1/3] Update scrollglue.js In some circumstances for example when you use $scope.$apply in promises to update view, scrolling not work. This fix use timeout to make shure that every changes in view was made before updating activationState and scrolling --- src/scrollglue.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/scrollglue.js b/src/scrollglue.js index 04c3649..b5c8a33 100644 --- a/src/scrollglue.js +++ b/src/scrollglue.js @@ -64,11 +64,13 @@ link: function(scope, $el, attrs){ var el = $el[0], activationState = createActivationState($parse, attrs[attrName], scope); - + function scrollIfGlued() { - if(activationState.getValue() && !direction.isAttached(el)){ - direction.scroll(el); - } + $timeout(function(){ + if(activationState.getValue() && !direction.isAttached(el) ){ + direction.scroll(el); + } + },0,false); } function onScroll() { @@ -77,12 +79,13 @@ scope.$watch(scrollIfGlued); - $timeout(scrollIfGlued, 0, false); + scrollIfGlued(); $window.addEventListener('resize', scrollIfGlued, false); - $el.bind('scroll', onScroll); - + $el.on('scroll', function(){ + $timeout(onScroll, 0, false); + }); // Remove listeners on directive destroy $el.on('$destroy', function() { From ce3d83058f3bcda4bb080b9cbed7430297db7020 Mon Sep 17 00:00:00 2001 From: supersnager Date: Sun, 17 Jan 2016 17:03:53 +0100 Subject: [PATCH 2/3] Update version to 2.0.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3ff2e13..d941e54 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "Lukas Wegmann", "name": "angularjs-scroll-glue", - "version": "2.0.6", + "version": "2.0.7", "main" : "src/scrollglue.js", "keywords": [ "angular", From bc449cd43cb06d4e8260b3a308c27671b55bf749 Mon Sep 17 00:00:00 2001 From: supersnager Date: Sun, 17 Jan 2016 17:04:18 +0100 Subject: [PATCH 3/3] Update version to 2.0.7 --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 9000c2c..00aaa17 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-scroll-glue", - "version": "2.0.6", + "version": "2.0.7", "homepage": "https://github.com/Luegg/angularjs-scroll-glue", "authors": [ "Lukas Wegmann"