I have menu that has
<li><a href="{{ 'home'|page }}" class="scroll">Contact</a></li>
And functon that triggers scroll to part where contact form is.
$(function(){
$(".scroll").click(function(){
$("html,body").animate({scrollTop:$("#contact").offset().top},"500");
return false;
});
if (window.location.hash == "#contact") $(".scroll").trigger("click");
});
The problem is when I am on some other part of my website and click on Contact link it opens home page but never triggers that scroll. How can I make that everytime that link is clicked it opens home and scrolls or if on home page then just scrolls?
Last updated