File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 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', [
1111 } ,
1212 link : function ( $scope , elem , attrs ) {
1313 var setPosition = function ( ) {
14+ if ( ! $scope . parallaxHorizontalOffset ) $scope . parallaxHorizontalOffset = '0' ;
1415 var calcValY = $window . pageYOffset * ( $scope . parallaxRatio ? $scope . parallaxRatio : 1.1 ) ;
1516 if ( calcValY <= $window . innerHeight ) {
1617 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)' ) ;
1820 }
1921 } ;
2022
You can’t perform that action at this time.
0 commit comments