I've been banging my head trying to make scrollspy work. I'm currently doing a project scaffolded by yeomans angular generator
with angular-ui router
. It seems i'm in bad luck using any of the data-spy things.
Can anyone take a look what could be the cause?
Code snippets:
index.html
<nav class="navbar navbar-fixed-top navbar-default">
<div class="container">
.. omitted
<div id="char-nav" class="collapse">
<ul class="nav nav-tabs">
<li class=""><a href="#char-identity">Identity</a></li>
<li class=""><a href="#char-attributes">Attributes</a></li>
<li class=""><a href="#char-skills">Skills</a></li>
<li class=""><a href="#char-spells">Spells</a></li>
<li class=""><a href="#char-passives">Passives</a></li>
<li class=""><a href="#char-equipment">Equipment</a></li>
<li class=""><a href="#char-consumables">Consumables</a></li>
</ul>
</div>
</div>
</nav>
...
<div class="container">
<div class="row row-offcanvas row-offcanvas-right">
<div class="col-xs-12 col-sm-9">
<my-notification></my-notification>
<div ui-view></div>
</div>
...omitted
character.html
<div id="character-views" data-offset-top="0" data-spy="scroll" data-target="#char-nav">
<div class="character-view" ng-include="'views/character/identity.html'"></div>
<div class="character-view" ng-include="'views/character/attributes.html'"></div>
<div class="character-view" ng-include="'views/character/skills.html'"></div>
<div class="character-view" ng-include="'views/character/spells.html'"></div>
<div class="character-view" ng-include="'views/character/passives.html'"></div>
<div class="character-view" ng-include="'views/character/equipment.html'"></div>
<div class="character-view" ng-include="'views/character/consumables.html'"></div>
</div>
The character page is built up by several partials, this is the page i wish to spy on.
Any of the pages in my list of ng-includes start with a header like so:
<header id="char-identity" class="character-view-header">Identity</header>
<hr>
这个AngularStrap项目可以为您提供帮助。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.