javascript - Remove attribute scroll spy Angular.js -
i have script angular.js , have smooth scroll on page scrollspy, menu animates when scrolling of page normal don't want it, want disable scroll spy , reactivate after.
i tried remove attribute scrollspy before scrolling et reactivate after scroll spy works again don't know why.
this code :
$(document).ready(function() { $('.scroll').click( function() { // au clic sur un élément $('.nav a.scroll').removeattr('du-scrollspy'); var page = $(this).attr('href'); // page cible var speed = 750; // durée de l'animation (en ms) var top = $(page).offset().top-24; $('html, body').animate( { scrolltop: top }, speed ); // go $('.nav a.scroll').attr('du-scrollspy',""); return false; }); }); <ul class="nav nav-list"> <li> <a class="scroll" href="#section1_1" du-scrollspy offset="20">section1_1</a> </li> <li> <a class="scroll" href="#section1_2" du-scrollspy offset="20">section1_2</a> </li> <li> <a class="scroll" href="#section1_3" du-scrollspy offset="20">section1_3</a> </li> </ul>
i use scroll spy because have script angularjs : https://github.com/oblador/angular-scroll
Comments
Post a Comment