File tree 4 files changed +8
-8
lines changed
4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 22
22
Include module and dependencies.
23
23
``` html
24
24
<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 >
26
26
<script src =" http://durated.github.io/angular-parallax/angular-parallax.min.js" ></script >
27
27
```
28
28
Original file line number Diff line number Diff line change 15
15
],
16
16
"dependencies" : {
17
17
"angular" : " 1.2.x" ,
18
- "angular-scroll" : " ~0.2.9 "
18
+ "angular-scroll" : " >=0.5.0 "
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -56,8 +56,8 @@ <h1>Responsive Angular.js Parallax Example</h1>
56
56
</ div >
57
57
58
58
< 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 >
60
59
< 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 >
61
61
< script >
62
62
angular . module ( 'myApp' , [ 'duParallax' ] ) .
63
63
controller ( 'MyCtrl' , function ( $scope , parallaxHelper ) {
Original file line number Diff line number Diff line change 1
1
angular . module ( 'duParallax.directive' , [ 'duScroll' ] ) .
2
2
directive ( 'duParallax' ,
3
- function ( $rootScope , scrollPosition , $window ) {
3
+ function ( $rootScope , $window , $document ) {
4
4
//Never mind touch devices
5
5
if ( 'ontouchstart' in window ) {
6
6
return ;
@@ -56,7 +56,8 @@ directive('duParallax',
56
56
var currentProperties ;
57
57
var inited = false ;
58
58
59
- var onScroll = function ( $event , scrollY ) {
59
+ var onScroll = function ( ) {
60
+ var scrollY = $document . scrollTop ( ) ;
60
61
var rect = element . getBoundingClientRect ( ) ;
61
62
if ( ! inited ) {
62
63
inited = true ;
@@ -69,7 +70,7 @@ directive('duParallax',
69
70
var lastY ;
70
71
do {
71
72
lastY = currentY ;
72
- onScroll ( $event , scrollY ) ;
73
+ onScroll ( ) ;
73
74
currentY = element . getBoundingClientRect ( ) . top ;
74
75
i ++ ;
75
76
} while ( i < maxIterations && lastY !== currentY ) ;
@@ -108,8 +109,7 @@ directive('duParallax',
108
109
currentProperties = properties ;
109
110
}
110
111
} ;
111
-
112
- $rootScope . $on ( '$duScrollChanged' , onScroll ) ;
112
+ $document . on ( 'scroll' , onScroll ) ;
113
113
114
114
}
115
115
} ;
You can’t perform that action at this time.
0 commit comments