html - Bootstrap 3 Scrollspy Activate Event Not Firing -


i'm trying create site using bootstrap 3 rc1 scrollspy. web page pretty simple right now, , set this:

<html>     <head>         <!-- head stuff here -->     </head>      <body>         <section id="section_1" data-spy="scroll">             <!-- stuff in here -->         </section>         <section id="section_2" data-spy="scroll">             <!-- stuff in here -->         </section>         <section id="section_3" data-spy="scroll">             <!-- stuff in here -->         </section>          <jscripts here ... />     </body> </html> 

i've initialized scrollspy calling $("section").scrollspy() , i've set event handler this:

$("section").on("activate", function(e) {     // stuff }); 

my problem activate event never gets fired. know why it's not working? noticed tutorials use navbar highlighting current section, don't want navbar.

your markup scrollspy little off. scrollspy may not firing why not getting results. in experience it's easier user data attributes initiate scrollspy. , haven't read 1 report of working if append scroll listener other element body itself.

you should apply them body tag this.

<body data-spy="scroll" data-target="#your nav container"> 

also, need make sure navigation structure this:

<div id="your nav container">      <ul class="nav">           <li><a href="#sectionid">list item</a></li>           <li><a href="#sectionid">list item2</a></li>      </ul> </div> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -