gpt4 book ai didi

javascript - Scrollspy for Materialise 根本不使用 Angularjs 滚动

转载 作者:行者123 更新时间:2023-12-02 15:07:45 24 4
gpt4 key购买 nike

我正在尝试使用 Materialize ( http://materializecss.com/scrollspy.html ) 中的滚动 spy 来定位使用 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。最后一件事:物化的其他功能对我有用,但滚动 spy 除外。我也这么做

$(document).ready(function(){
$('.scrollspy').scrollSpy();
});

最佳答案

我认为如果您从 href 中删除 #/community ,它应该可以工作。 href 应包含 block 的 id,而不是额外的 url 信息。例如尝试使用

<a href="#experiencingGod">Experiencing God</a>

关于javascript - Scrollspy for Materialise 根本不使用 Angularjs 滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34999638/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com