Skip to content

Commit b718aa5

Browse files
committed
Allow vertical offset for backgrounds
Allows for an attribute to be set, which will be subtracted from the calculated y position. Defaults to 0.
1 parent 96d0586 commit b718aa5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: scripts/angular-parallax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ angular.module('angular-parallax', [
3636
},
3737
link: function($scope, elem, attrs) {
3838
var setPosition = function () {
39-
var calcValY = (elem.prop('offsetTop') - $window.pageYOffset) * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 );
39+
var calcValY = (elem.prop('offsetTop') - $window.pageYOffset) * ($scope.parallaxRatio ? $scope.parallaxRatio : 1.1 ) - ( attrs.parallaxVerticalOffset || 0);
4040
// horizontal positioning
4141
elem.css('background-position', "50% " + calcValY + "px");
4242
};

0 commit comments

Comments
 (0)