【发布时间】:2016-01-25 18:26:59
【问题描述】:
我正在尝试使用 Materialize (http://materializecss.com/scrollspy.html) 中的 scrollspy 来定位使用 ng-repeat 创建的每个 div。
但是,在我看来,scrollspy 类似乎没有做任何事情。 DOM 不会滚动到页面的该部分,而是重新加载并指向页面的该部分。
另一个问题是使用href="/#community#sharingLove" 正在更改网站URL。无论如何,scrollspy 是否可以在不添加 URL 的情况下工作?
<div class="full-height row" ng-controller="CommunityController">
<div class="col l10 main-content">
<div ng-repeat="principle in acmPrinciples" id ="{{principle.id}}" class="row full-width centering-text section scrollspy">
<div class ="col-md-12">
<h4>{{principle.title}}<h4>
</div>
<div class ="col-md-12 comm-description-container">
<p class="paragraph-style larger-font-size">
{{principle.description}}
</p>
</div>
<div class ="col-md-12">
<video class="responsive-video comm-video-height" controls>
<source ng-src="{{principle.videoURL}}" type="video/mp4">
</video>
</div>
</div>
</div>
<div class="col l2 scroll-content">
<div class="row">
<div class="col hide-on-small-only m3 l2 scroll-items">
<ul class="section table-of-contents">
<li><a href="#/community#experiencingGod">Experiencing God</a></li>
<li><a href="#/community#sharingLove">Sharing Love</a></li>
<li><a href="#/community#conntectingLives">Connecting Lives</a></li>
<li><a href="#/community#declaringTruth">Declaring Truth</a></li>
</ul>
</div>
</div>
</div>
</div>
我已经链接了包括 jQuery、bootstrap 和 materialize。最后一件事:物化的其他功能对我有用,只是不是滚动间谍。我也喜欢
$(document).ready(function(){
$('.scrollspy').scrollSpy();
});
【问题讨论】:
-
在jsfiddle.net添加示例
标签: javascript jquery angularjs materialize scrollspy