Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <nav class="desktop">
- <ul>
- <li><a href="/">Home</a></li>
- <li><a href="/cardapio">Cardápio</a></li>
- <li><a class="interno" href="#destaques">Destaques</a></li>
- <li><a class="interno" href="#galeria">Galeria</a></li>
- <li><a class="interno" href="#sobre">Sobre</a></li>
- <li><a class="interno" href="#contato">Contato</a></li>
- </ul>
- </nav>
- $('.main-header .top-header nav.desktop ul li a.interno').click(function(e){
- e.preventDefault();
- var id = $(this).attr('href');
- targetOffset = $(id).offset().top,
- menuHeight = $('.main-header .top-header').innerHeight();
- $('html, body').animate({
- scrollTop: targetOffset - menuHeight
- }, 1000);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement