File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 6
6
< div ng-controller ="ParallaxExampleCtrl ">
7
7
< h1 parallax parallax-ratio ="1.22 " parallax-vertical-offset ="10 " parallax-horizontal-offset ="600 " class ="parallax "> Angular Parallax</ h1 >
8
8
< div parallax-background class ="photo nature " parallax-ratio ="0.5 "> < span style ="font-size:1em; "> Nature</ span > </ div >
9
- < div parallax-background class ="photo food " parallax-ratio ="0.8 "> < span style ="font-size:4em; "> Food</ span > </ div >
9
+ < div parallax-background class ="photo food " parallax-ratio ="0.8 " parallax-vertical-offset =" 100 " > < span style ="font-size:4em; "> Food</ span > </ div >
10
10
< div parallax-background class ="photo animals " parallax-ratio ="0.7 "> Animals</ div >
11
11
< div parallax-background class ="photo cats " parallax-ratio ="1 "> Cats</ div >
12
12
< img parallax parallax-ratio ="1.88 " parallax-vertical-offset ="100 " parallax-horizontal-offset ="40 " class ="parallax " src ="images/muther.jpg " />
Original file line number Diff line number Diff line change @@ -33,10 +33,11 @@ angular.module('angular-parallax', [
33
33
template : '<div ng-transclude></div>' ,
34
34
scope : {
35
35
parallaxRatio : '@' ,
36
+ parallaxVerticalOffset : '@' ,
36
37
} ,
37
38
link : function ( $scope , elem , attrs ) {
38
39
var setPosition = function ( ) {
39
- var calcValY = ( elem . prop ( 'offsetTop' ) - $window . pageYOffset ) * ( $scope . parallaxRatio ? $scope . parallaxRatio : 1.1 ) - ( attrs . parallaxVerticalOffset || 0 ) ;
40
+ var calcValY = ( elem . prop ( 'offsetTop' ) - $window . pageYOffset ) * ( $scope . parallaxRatio ? $scope . parallaxRatio : 1.1 ) - ( $scope . parallaxVerticalOffset || 0 ) ;
40
41
// horizontal positioning
41
42
elem . css ( 'background-position' , "50% " + calcValY + "px" ) ;
42
43
} ;
You can’t perform that action at this time.
0 commit comments