friends
I create a single page site that uses the jQuery function to scroll to the anchor when selecting a menu link. Here is the code I'm using:
(function($) {
var jump = function(e)
{
if (e) {
e.preventDefault();
var target = $(this).attr("href");
} else {
var target = location.hash;
}
$('html,body').animate(
{
scrollTop: $(target).offset().top - 150
}, 1500, 'swing', function()
{
location.hash = target - 150;
});
}
$('html, body').hide()
$(document).ready(function()
{
$('a[href^=#]').bind("click", jump);
if (location.hash) {
setTimeout(function() {
$('html, body').scrollTop(0).show()
jump()
}, 0);
} else {
$('html, body').show()
}
});
})(jQuery)
Now this function is called for all html elements 'a' with 'href'. I need to change the function above, so it will work for all specific links except this, with a binding #nav-menu:
<a href="#nav-menu" id="toggle"><span></span></a>
Any suggestions would be much appreciated.
source
share