added Math.min in case the parent is smaller

This commit is contained in:
Travis Russi
2013-11-30 16:57:56 -08:00
parent c96a46a0d7
commit 1fd7be8785
2 changed files with 10 additions and 5 deletions

View File

@@ -62,7 +62,11 @@ angular.module('ionic.ui.content', [])
addedPadding = true;
}
$element.append(sc);
// Pass the parent scope down to the child
clone = transclude($scope.$parent);
angular.element($element[0].firstElementChild).append(clone);
// Otherwise, supercharge this baby!
// Add timeout to let content render so Scroller.resize grabs the right content height
$timeout(function() {
@@ -85,9 +89,6 @@ angular.module('ionic.ui.content', [])
$scope.$parent.scrollView = sv;
}, 100);
// Pass the parent scope down to the child
clone = transclude($scope.$parent);
angular.element($element[0].firstElementChild).append(clone);
}
// if padding attribute is true, then add padding if it wasn't added to the .scroll

View File

@@ -583,7 +583,11 @@ var Scroller;
resize: function() {
// Update Scroller dimensions for changed content
// Add padding to bottom of content
this.setDimensions(this.__container.clientWidth, this.__container.clientHeight, this.__content.offsetWidth, this.__content.offsetHeight+50);
this.setDimensions(
Math.min(this.__container.clientWidth, this.__container.parentElement.clientWidth),
Math.min(this.__container.clientHeight, this.__container.parentElement.clientHeight),
this.__content.offsetWidth,
this.__content.offsetHeight+50);
},
/*
---------------------------------------------------------------------------