【发布时间】:2014-01-17 00:46:28
【问题描述】:
我遵循了这个答案并提出了一个例子:
How to implement a scrollspy in angular.js the right way?
我的目的是使用模板填充动态内容,其中有图像:
**HTML代码区别:((
<div ng-repeat="item in items">
<h4 id="{{ item.id }}">{{ item.id }}</h4>
<p ng-repeat="img in [1,2,3,4,5]"><img ng-src="{{ item.src }}"></p>
</div>
Javascript代码区别:
angular.module('scrollSpyPlunk')
.controller('scrollSpyCtrl', function ($scope, $anchorScroll)
{
$scope.items = [{
"id": "section1",
"src": "http://placehold.it/400x400"
},{
"id": "section2",
"src": "http://placehold.it/400x400"
},{
"id": "section3",
"src": "http://placehold.it/400x400"
}]
});
scrollspy 功能似乎无法按预期工作。当我向下滚动时,它太早地激活了菜单。我认为它将图像仅视为一行文本。我不确定。
任何帮助解决这个问题?
【问题讨论】:
标签: javascript angularjs twitter-bootstrap angular-ui-bootstrap scrollspy