更新一下编辑按钮位置纠正的timer

This commit is contained in:
luchenqun 2017-02-27 17:56:15 +08:00
parent 15b5487743
commit 8c2f168826
2 changed files with 28 additions and 27 deletions

View File

@ -182,9 +182,10 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
// TODO: 我要将编辑按钮固定在容器的右上角
$(window).resize(updateEditPos);
setTimeout(updateEditPos, 100);
updateEditPos();
function updateEditPos() {
for(var i=1; i<=10; i++){
setTimeout(function() {
if ($scope.showStyl == 'navigate') {
var t = $('.js-segment-navigate').offset().top;
@ -196,6 +197,7 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
left: l + w - 10,
})
}
}, 100)
}, 100 * i)
}
}
}]);

View File

@ -317,12 +317,10 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
// TODO: 我要将编辑按钮固定在容器的右上角
$(window).resize(updateEditPos);
setTimeout(updateEditPos, 100);
setTimeout(updateEditPos, 500);
setTimeout(updateEditPos, 1000);
setTimeout(updateEditPos, 10000);
updateEditPos();
function updateEditPos() {
for (var i = 1; i <= 10; i++) {
setTimeout(function() {
var t = $('.js-tags').offset().top;
var l = $('.js-tags').offset().left;
@ -332,7 +330,8 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
top: t + 10,
left: l + w - 10,
})
}, 100)
}, 100 * i)
}
}
}]);