Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <nav>
- <ul>
- <li><a href="#ancla1">ancla1</a></li>
- <li><a href="#ancla2">ancla2</a></li>
- <li><a href="#ancla3">ancla3</a></li>
- </ul>
- </nav>
- $(document).ready(function () {
- $('a').click(function(e){ // <-- cambiar esto
- e.preventDefault();
- $('html, body').stop().animate({scrollTop: $($(this).attr('href')).offset().top}, 1000);
- });
- });
- <nav>
- <ul>
- <li><a class="interno" href="#ancla1">ancla1</a></li>
- <li><a class="interno" href="#ancla2">ancla2</a></li>
- <li><a class="interno" href="#ancla3">ancla3</a></li>
- </ul>
- </nav>
- $(document).ready(function () {
- $('a.interno').click(function(e){ // <-- mira el cambio
- e.preventDefault();
- $('html, body').stop().animate({scrollTop: $($(this).attr('href')).offset().top}, 1000);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement