Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(backdrop): define var in valid scope for all reference sites
Browse files Browse the repository at this point in the history
Closes #9226
  • Loading branch information
jelbourn authored and ThomasBurleson committed Aug 3, 2016
1 parent 05d4ee8 commit fc536e9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/backdrop/backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ angular
// backdrop may be outside the $rootElement, tell ngAnimate to animate regardless
if ($animate.pin) $animate.pin(element, $rootElement);

var bodyRect;
$$rAF(function () {
// If body scrolling has been disabled using mdUtil.disableBodyScroll(),
// adjust the 'backdrop' height to account for the fixed 'body' top offset.
// Note that this can be pretty expensive and is better done inside the $$rAF.
var body = $window.getComputedStyle($document[0].body);
if (body.position == 'fixed') {
var hViewport = parseInt(body.height, 10) + Math.abs(parseInt(body.top, 10));
bodyRect = $window.getComputedStyle($document[0].body);
if (bodyRect.position == 'fixed') {
var hViewport = parseInt(bodyRect.height, 10) + Math.abs(parseInt(bodyRect.top, 10));
element.css({
height: hViewport + 'px'
});
Expand Down Expand Up @@ -66,7 +67,7 @@ angular
});

function resize() {
var hViewport = parseInt(body.height, 10) + Math.abs(parseInt(body.top, 10));
var hViewport = parseInt(bodyRect.height, 10) + Math.abs(parseInt(bodyRect.top, 10));
element.css({
height: hViewport + 'px'
});
Expand Down

0 comments on commit fc536e9

Please sign in to comment.