You can put a hash #servicosN
(where N
is the link number) in the URL and use window.scrollTo
to scroll the screen to the menu and fire a click
on the menu link. Link example:
http://www.clinvetimbituba.com.br/servicos.html#servicos1
And put this script on page servicos.html
:
document.addEventListener("DOMContentLoaded", function(){
var target = location.hash; // verifica se tem hash na URL
var linq = $("ul.nav-tabs li a[href$='"+target+"']"); // link que contém a hash
if(target && linq.length){
setTimeout(function(){
// distância do menu ao topo menos altura do nav
var top = $(".sidebar").offset().top - $("#main-nav").height();
window.scrollTo(0, top); // rola atela até o menu
linq.trigger("click"); // dispara o clique
}, 500);
}
});