Ah, yes, that's exactly what's happening. It's not the prettiest fix, but here's something quick you can do:
1. Prevent the default click action, and send the link's `href` to your function.
Change your onclick handler to the following:
HTML Code:
<a href="..." onClick="goToByScroll('morocco_achor3', '...'); return false">
2. Change your 'goToByScroll' function to redirect the window when the animation is done.
Add a function to your `animate` method (and don't forget that you're now passing two arguments to `goToByScroll`):
Code:
function goToByScroll(id, where_to){
$('html,body').stop().animate({scrollTop: $("#"+id).offset().top},'slow', function () {
window.location = where_to;
});
}
Bookmarks