Skip to content

Commit 899e492

Browse files
committed
Released v0.1.6.
1 parent 71ac75a commit 899e492

6 files changed

+11
-11
lines changed

angular-parallax.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ factory('parallaxHelper',
2121

2222
angular.module('duParallax.directive', ['duScroll']).
2323
directive('duParallax',
24-
function($rootScope, scrollPosition, $window){
24+
function($rootScope, $window, $document){
2525
//Never mind touch devices
2626
if('ontouchstart' in window) {
2727
return;
@@ -77,11 +77,12 @@ directive('duParallax',
7777
var currentProperties;
7878
var inited = false;
7979

80-
var onScroll = function($event, scrollY){
80+
var onScroll = function(){
81+
var scrollY = $document.scrollTop();
8182
var rect = element.getBoundingClientRect();
8283
if(!inited) {
8384
inited = true;
84-
angular.element($window).on('load', function initParallax() {
85+
angular.element($window).on('load', function init() {
8586
//Trigger the onScroll until position stabilizes. Don't know why this is needed.
8687
//TODO: Think of more elegant solution.
8788
var i = 0;
@@ -90,7 +91,7 @@ directive('duParallax',
9091
var lastY;
9192
do {
9293
lastY = currentY;
93-
onScroll($event, scrollY);
94+
onScroll();
9495
currentY = element.getBoundingClientRect().top;
9596
i++;
9697
} while(i < maxIterations && lastY !== currentY);
@@ -129,8 +130,7 @@ directive('duParallax',
129130
currentProperties = properties;
130131
}
131132
};
132-
133-
$rootScope.$on('$duScrollChanged', onScroll);
133+
$document.on('scroll', onScroll);
134134

135135
}
136136
};

angular-parallax.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular-parallax.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng-parallax",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"main": "angular-parallax.min.js",
55
"ignore": [
66
"**/.*",

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-parallax/0.1.5/angular-parallax.min.js"></script>
6059
<script src="http://durated.github.io/angular-scroll/0.5.0/angular-scroll.min.js"></script>
60+
<script src="http://durated.github.io/angular-parallax/0.1.6/angular-parallax.min.js"></script>
6161
<script>
6262
angular.module('myApp', ['duParallax']).
6363
controller('MyCtrl', function($scope, parallaxHelper){

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-parallax",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Lightweight and performant parallax scrolling for angular.js",
55
"keywords": ["angular", "parallax", "parallax-scrolling"],
66
"main": "angular-parallax.min.js",

0 commit comments

Comments
 (0)