2
Yesterday I did that question, and it all worked out. What I need is that when I open the site directly on the www.meusite.com.br link/test it opens exactly where the "test" is, I used scrollTop for navigation.
So I think the ideal is to be done in JS a direct automatic 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>
The 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 http://www.meusite.com.br/teste he right click on li
and go to the scrollTop that I defined.
Has as?
http://jsfiddle.net/joayryx9/5/, I made it here. Only in this case, the only way it works is that the classes are equal to the link. example: /over-the-hotel, the class of the li has to be over-the-hotel
– Joao Paulo
Let’s go continue this discussão in chat.
– Joao Paulo