發生
經過幾次嘗試之後,我將這個bug留在一邊,轉到其他函數,並且在控制標籤的指令中進行更正時,我注意到一旦加載了新標籤,我就可以重新計算滾動大小。添加以下行單擊函數:
$ionicScrollDelegate.resize(); //Fix box resize bug when trasition between tabs
功能去如此:
$timeout(function() {
childElem = angular.element(document.querySelector(".child")).prop('children');
if(childElem.length){
for (var i = 0; i < childElem.length; i++) {
angular.element(childElem[i]).on('click', function (e) {
var tab = angular.element(e.path ? e.path[0] : e.target).prop('id').replace(/tab/g, "");
$rootScope.$emit('aba_ativa_feed', tab); // informa a view feed qual a aba ativa
for (var i = 0; i < tabs.length; i++) {
if(i == tab - 1) {
ativos[i] = true;
} else {
ativos[i] = false;
angular.element(document.querySelector("#tab-nav-block-id-".concat(i+1))).addClass('ng-hide');
}
}
angular.element(document.querySelector("#tab-nav-block-id-".concat(tab))).removeClass('ng-hide');
$ionicScrollDelegate.scrollTo(0, blocksScrollPosition[tab - 1], true);
scope.active = ativos;
scope.$apply();
$ionicScrollDelegate.resize(); //Fix box resize bug when trasition between tabs
})
}
}
}, 200)
更多細節看here