[英]offset for $location.hash and $anchorScroll()
我根據id
進行錨定滾動-這樣-
function ($scope, $location, $anchorScroll) {
$scope.gotoBottom = function() {
// set the location.hash to the id of
// the element you wish to scroll to.
$location.hash('bottom');
// call $anchorScroll()
$anchorScroll();
};
由於固定的標頭,我必須為此$location.hash('bottom')
設置一個偏移量(常見的問題是將html錨點偏移以調整為固定的標頭 )。
如何獲得補償?
試試這個
$ anchorScroll.yOffset = 20;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.