File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ angular.module('angular-parallax', [
11
11
} ,
12
12
link : function ( $scope , elem , attrs ) {
13
13
var setPosition = function ( ) {
14
+ if ( ! $scope . parallaxHorizontalOffset ) $scope . parallaxHorizontalOffset = '0' ;
14
15
var calcValY = $window . pageYOffset * ( $scope . parallaxRatio ? $scope . parallaxRatio : 1.1 ) ;
15
16
if ( calcValY <= $window . innerHeight ) {
16
17
var topVal = ( calcValY < $scope . parallaxVerticalOffset ? $scope . parallaxVerticalOffset : calcValY ) ;
17
- elem . css ( 'transform' , 'translate(' + $scope . parallaxHorizontalOffset + 'px, ' + topVal + 'px)' ) ;
18
+ var hozVal = ( $scope . parallaxHorizontalOffset . indexOf ( "%" ) === - 1 ? $scope . parallaxHorizontalOffset + 'px' : $scope . parallaxHorizontalOffset ) ;
19
+ elem . css ( 'transform' , 'translate(' + hozVal + ', ' + topVal + 'px)' ) ;
18
20
}
19
21
} ;
20
22
You can’t perform that action at this time.
0 commit comments