I have this menu on home page
that scrolls to the id
positions:
<li><a href="#event-section">El evento</a></li>
<li><a href="#asistentes-section">Asistentes</a></li>
<li><a href="#contact-section">Contacto & Inscripciones</a></li>
I'm using this script for the smooth scrolling:
var $root = $('html, body');
$('a').click(function() {
$root.animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
return false;
});
This works perfectly.
The problem is that I have another page in the site. When the user enters to it and click on any link of the menu, it just doesn't work since the divs
exists only on home page
. I want that if the user is in this other page and clicks on a link of the menu then the home page
opens going to that section.
Any idea how can I fix this menu to be able to do both things?