Skip to content

Commit 71ac75a

Browse files
committed
Updated to work with latest angular-scroll.
1 parent 197fa5c commit 71ac75a

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Usage
2222
Include module and dependencies.
2323
```html
2424
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
25-
<script src="http://durated.github.io/angular-scroll/0.2.8/angular-scroll.min.js"></script>
25+
<script src="http://durated.github.io/angular-scroll/0.5.0/angular-scroll.min.js"></script>
2626
<script src="http://durated.github.io/angular-parallax/angular-parallax.min.js"></script>
2727
```
2828

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
],
1616
"dependencies": {
1717
"angular": "1.2.x",
18-
"angular-scroll": "~0.2.9"
18+
"angular-scroll": ">=0.5.0"
1919
}
2020
}

example/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ <h1>Responsive Angular.js Parallax Example</h1>
5656
</div>
5757

5858
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
59-
<script src="http://durated.github.io/angular-scroll/0.2.9/angular-scroll.min.js"></script>
6059
<script src="http://durated.github.io/angular-parallax/0.1.5/angular-parallax.min.js"></script>
60+
<script src="http://durated.github.io/angular-scroll/0.5.0/angular-scroll.min.js"></script>
6161
<script>
6262
angular.module('myApp', ['duParallax']).
6363
controller('MyCtrl', function($scope, parallaxHelper){

src/directives/parallax.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
angular.module('duParallax.directive', ['duScroll']).
22
directive('duParallax',
3-
function($rootScope, scrollPosition, $window){
3+
function($rootScope, $window, $document){
44
//Never mind touch devices
55
if('ontouchstart' in window) {
66
return;
@@ -56,7 +56,8 @@ directive('duParallax',
5656
var currentProperties;
5757
var inited = false;
5858

59-
var onScroll = function($event, scrollY){
59+
var onScroll = function(){
60+
var scrollY = $document.scrollTop();
6061
var rect = element.getBoundingClientRect();
6162
if(!inited) {
6263
inited = true;
@@ -69,7 +70,7 @@ directive('duParallax',
6970
var lastY;
7071
do {
7172
lastY = currentY;
72-
onScroll($event, scrollY);
73+
onScroll();
7374
currentY = element.getBoundingClientRect().top;
7475
i++;
7576
} while(i < maxIterations && lastY !== currentY);
@@ -108,8 +109,7 @@ directive('duParallax',
108109
currentProperties = properties;
109110
}
110111
};
111-
112-
$rootScope.$on('$duScrollChanged', onScroll);
112+
$document.on('scroll', onScroll);
113113

114114
}
115115
};

0 commit comments

Comments
 (0)