dav*_*s.1 5 javascript ionic-framework ionic
我有一个:
<span id="quote-{{quote.id}}" ng-repeat="quote in quotes">{{quote.text}}</span>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用索引滚动到滚动条的任何部分:
$scope.jumpToQuote = function (quote) {
$scope.quoteSelected = quote;
var quotePosition = $ionicPosition.position(angular.element(document.getElementById('quote-'+quote)));
$ionicScrollDelegate.$getByHandle('quotes-box').scrollTo(quotePosition.left, quotePosition.top, true);
}
Run Code Online (Sandbox Code Playgroud)
但是,quotePosition.top的值总是等于10,这是最高的偏移量<ion-scroll>.
据我所知,您需要替换document.getElementById('quote-'+quote)为document.getElementById('quote-'+quote.id),您正在连接整个quote对象而不是它的id。
| 归档时间: |
|
| 查看次数: |
6894 次 |
| 最近记录: |