The template I downloaded has a top menu but this is not working. The code is quite different that what I am use to, so I have been unable to resolve. Any ideas welcome.
Apparently the script is trying to use the href attribute as a selector to find the target element and scroll it into view. So you’ll have to link to an element on the same page, e.g. #video (like in the snippet you posted here).
I really appreciate your reply, thank you so much.
I guessed what you explained is what the original template menu was trying to do, but that wouldn’t work either. That is index2.html.
How can I change the format to link to external pages? I tried deleting various commands without success in achieving that. index.html was what I tried.
Well it seems that this menu is designed as a mere in-page navigation. The part responsible for this is in your main.js ll. 88 - 95; you might either delete that block altogether, or modify it in the following way so that you can follow external links too while still doing that scrolling thing when navigating within the same document:
jQuery('.nav > li > a, #logo a').click(function(e) {
var href = e.target.getAttribute('href');
// If the href doesn't start with a hash, do nothing
if (href[0] !== '#') {
return;
}
// Otherwise prevent following the link and scroll
// to the corresponding element instead
e.preventDefault();
jQuery.scrollTo(href, 400, {
offset:-(jQuery('#header #menu').height()), axis:'y'
});
});
Thank you m3g4p0p your advice is really welcome, I had no idea how to resolve the issues with the original menu.
I have replaced the lines in the main.js as you recommended.
Everything is working well know.