Skip to content

Commit

Permalink
Merge pull request #20 from jwanglof/master
Browse files Browse the repository at this point in the history
Add an if-statement that checks which height it should resize against
  • Loading branch information
rprovost authored Jun 17, 2016
2 parents 0cf78ee + 31893ec commit 5469e1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ng-backstretch.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ directive('backstretch', ['$window', '$timeout', function($window, $timeout) {
height: '100%',
width: '100%',
zIndex: -999998,
position: 'absolute',
position: 'absolute'
},
image: {
position: 'absolute',
Expand Down Expand Up @@ -102,7 +102,8 @@ directive('backstretch', ['$window', '$timeout', function($window, $timeout) {
var root_width = element[0].offsetWidth,
background_width = root_width,

root_height = element[0].offsetHeight,
// Check which height-element that should be used
root_height = element[0].offsetHeight > 0 ? element[0].offsetHeight : element[0].offsetParent.offsetHeight,
background_height = background_width / scope.ratio,

background_offset;
Expand Down

0 comments on commit 5469e1e

Please sign in to comment.