mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge pull request #241 from travisrussi/228-scroll
Scrolling on iPhone5 running iOS7 seems to be working
This commit is contained in:
59
js/ext/angular/src/directive/ionicContent.js
vendored
59
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -18,7 +18,7 @@ angular.module('ionic.ui.content', [])
|
||||
|
||||
// The content directive is a core scrollable content area
|
||||
// that is part of many View hierarchies
|
||||
.directive('content', ['$parse', function($parse) {
|
||||
.directive('content', ['$parse', '$timeout', function($parse, $timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
@@ -62,28 +62,49 @@ angular.module('ionic.ui.content', [])
|
||||
addedPadding = true;
|
||||
}
|
||||
$element.append(sc);
|
||||
// Otherwise, supercharge this baby!
|
||||
sv = new ionic.views.Scroller({
|
||||
el: $element[0]
|
||||
});
|
||||
/*
|
||||
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||
onRefresh: function() {
|
||||
$scope.onRefresh();
|
||||
$scope.$parent.$broadcast('scroll.onRefresh');
|
||||
},
|
||||
onRefreshOpening: function(amt) {
|
||||
$scope.onRefreshOpening({amount: amt});
|
||||
$scope.$parent.$broadcast('scroll.onRefreshOpening', amt);
|
||||
}
|
||||
});
|
||||
*/
|
||||
// Let child scopes access this
|
||||
$scope.$parent.scrollView = sv;
|
||||
|
||||
// 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() {
|
||||
|
||||
// Add watch to the container element's height to fire Scroller.resize event
|
||||
// $scope.$watch
|
||||
// (
|
||||
// function () {
|
||||
// return typeof($element) !== "undefined" && $element.length > 0 && $element[0].clientHeight > 0 ? $element[0].clientHeight : 0;
|
||||
// },
|
||||
// function (newValue, oldValue) {
|
||||
// if (newValue != oldValue && $scope.$parent && $scope.$parent.scrollView && $scope.$parent.scrollView.resize) {
|
||||
// $scope.$parent.scrollView.resize();
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
sv = new ionic.views.Scroller({
|
||||
el: $element[0]
|
||||
});
|
||||
/*
|
||||
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||
onRefresh: function() {
|
||||
$scope.onRefresh();
|
||||
$scope.$parent.$broadcast('scroll.onRefresh');
|
||||
},
|
||||
onRefreshOpening: function(amt) {
|
||||
$scope.onRefreshOpening({amount: amt});
|
||||
$scope.$parent.$broadcast('scroll.onRefreshOpening', amt);
|
||||
}
|
||||
});
|
||||
*/
|
||||
// Let child scopes access this
|
||||
$scope.$parent.scrollView = sv;
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if padding attribute is true, then add padding if it wasn't added to the .scroll
|
||||
|
||||
@@ -582,7 +582,12 @@ var Scroller;
|
||||
|
||||
resize: function() {
|
||||
// Update Scroller dimensions for changed content
|
||||
this.setDimensions(this.__container.clientWidth, this.__container.clientHeight, this.__content.offsetWidth, this.__content.offsetHeight-50);
|
||||
// Add padding to bottom of content
|
||||
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);
|
||||
},
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user