1
頁
頂部我有下面的代碼anchorScroll不工作,去
$scope.scrollTo = function(id) {
alog($location.hash());
var toScrollId = "anchor" + id;
if($location.hash() !== toScrollId){
alog(" hash is not equal")
$location.hash(toScrollId);
}else{
alog(" hash is equal")
$anchorScroll();
}
};
和HTML看起來像
<button ng-click="scrollTo(raceid)">GO TO THIS</button>
<div ng-repeat="race in races" id="{{ 'anchor' + race.raceId}}">
</div>
但滾動總是轉到頁的頂部。我做錯了什麼?
你找到任何解決這個問題? – WASIF