jquery - bootstrap scrollspy first li only is highlighted -


i trying use scrollspy spy on set of dyanamically generated instructions, it's not working. first li item highlighted regardless of page position. body tag follows

<body data-spy="scroll" data-target=".stickysteps"> 

and how scrollspy activated

<% if manual.present? && manual.steps.present? %>  <div class="stickysteps"> <ul class="nav nav-pills">     <% n = 0 %>     <% @manual.steps.order(:priority).each |step| %>         <li><a href="#step<%= n+1 %>"><h4>step <%= n + 1 %></h4></a></li>         <% n += 1 %>     <% end %> </ul> </div> <h1 style="margin-left: 20px;">your instructions:</h1> </br> <% steps = manual.steps.order(:priority) %> <%= render(steps.order(:priority), steps: steps) %> <% end %>  <script type="text/javascript"> $('.stickysteps').scrollspy();  $('[data-spy="scroll"]').each(function () { $('.stickysteps').scrollspy('refresh'); }); $('#zoom_01').elevatezoom();  offsetvalue = 168; $('body').data().scrollspy.options.offset = offsetvalue; // force scrollspy recalculate offsets targets $('body').data().scrollspy.process(); </script> 

this frustrating me can't work, seems i've tried everything. if provide input appreciated.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -