Created
January 6, 2015 04:04
-
-
Save gbrennon/b4c68b4d6c2b75733ccb to your computer and use it in GitHub Desktop.
agency js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('a.page-scroll').bind('click', function(event) { | |
var $anchor = $(this); | |
$('html, body').stop().animate({ | |
scrollTop: $($anchor.attr('href')).offset().top | |
}, 1500, 'easeInOutExpo'); | |
event.preventDefault(); | |
}); | |
}); | |
// Highlight the top nav as scrolling occurs | |
$('body').scrollspy({ | |
target: '.navbar-fixed-top' | |
}) | |
// Closes the Responsive Menu on Menu Item Click | |
$('.navbar-collapse ul li a').click(function() { | |
$('.navbar-toggle:visible').click(); | |
}); |
vitorbritto
commented
Jan 6, 2015
Tente colocar o primeiro operando entre parênteses: ($($anchor.attr('href')).offset().top)
. Ficando assim: ($($anchor.attr('href')).offset().top) - $topmenu
.
Ou então, ao invés de atribuir o var $topmenu = $('.navbar-fixed-top').height();
, passe um literal inteiro para a subtração. Ex.: scrollTop: $($anchor.attr('href')).offset().top - 130
Aí, você vai testando até encontrar o valor correto. Ou tente inspecionar a altura do .navbar-fixed-top
e acrescente uns 40px. =]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment