Yesterday I did this question , and everything went well. What I need is that when I open the site directly on the link www.mysite.com/test it open exactly where the "test" is, I used scrollTop for navigation.
So, I think the ideal is to be done in JS an automatic direct click on my menu. Below is my HTML:
<ul class='menuItensPrincipal'>
<li class='menuFixoListHome'>
<div id='home' class='menuFixoListNome'><a href="home">Home</a></div>
<div class='menuFixoListFechar'></div>
</li>
<li class='clear'></li>
<li class='sobrehotel menuFixoList'><a href="/sobre-o-hotel">Sobre o Hotel</a></li>
<li class='tarifario menuFixoList'><a href="/tarifarios">Tarifário</a></li>
<li class='noticias menuFixoList'><a href="/noticias">Notícias</a></li>
<li class='reservas menuFixoList'><a href="/reservas">Reservas</a></li>
<li class='contato menuFixoList'><a href="/contato">Contato</a></li>
</ul>
Jquery:
$('#reserva').click(function (e) {
e.preventDefault();
setHistory("Reserva", "/reserva");
$('html, body').stop().animate({
scrollTop: '4680px'
}, 700);
});
$('#localizacao').click(function (e) {
e.preventDefault();
setHistory("Localização e Contato", "/contato");
$('html, body').stop().animate({
scrollTop: '5677px'
}, 700);
});
$('.sobrehotel, #sobrehotelRodape, #acomodacoes, #estrutura').click(function (e) {
e.preventDefault();
setHistory("Sobre o Hotel", "/sobre-o-hotel");
$('html, body').stop().animate({
scrollTop: '1000px'
}, 700);
});
$('.tarifario, #tarifarioRodape').click(function (e) {
e.preventDefault();
setHistory("Tarifário", "/tarifario");
$('html, body').stop().animate({
scrollTop: '2020px'
}, 700);
});
$('.noticias, #noticiasRodape, .socialBalao').click(function (e) {
e.preventDefault();
setHistory("Notícias", "/noticias");
$('html, body').stop().animate({
scrollTop: '3000px'
}, 700);
});
$('.reservas, #reservasRodape, #btReservaIr, #btReservaIr2').click(function (e) {
e.preventDefault();
setHistory("Reserva", "/reserva");
$('html, body').stop().animate({
scrollTop: '4670px'
}, 700);
});
$('.contato, #contatoRodape').click(function (e) {
e.preventDefault();
setHistory("Contato", "/contato");
$('html, body').stop().animate({
scrollTop: '5678px'
}, 700);
});
$('#home').click(function (e) {
e.preventDefault();
setHistory("Home", "/home");
$('html, body').stop().animate({
scrollTop: '0'
}, 700);
});
So, if I open paste in the browser the link link it directly in the li
and go to the < strong> scrollTop that I defined.
What is it like?