What I am trying to achieve is that if someone clicks on the specified link in the menu, it redirects to the homepage and then scrolls to the specific content.
My Jquery code is this simple:
$(document).ready(function () {
$("#upbar li:nth-of-type(2)").click(function(){
$(location).attr('href', 'index.html');
$('html,body').animate({
scrollTop: $("#samples").offset().top}, 700);
});
});
It redirects to the index.html page but it does not scroll :/
Thank you in advance!
Martin