Retour en arrière impossible avec .load

the_jb Messages postés 651 Date d'inscription   Statut Membre Dernière intervention   -  
the_jb Messages postés 651 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

j'ai un petit soucis concernant la navigation de mon site. j'utilise .load pour parcourir mes pages dans mon index.html :


<main id="main">
<script>
function afficher(page)
{
$("#main").hide().load(page).fadeIn('500');
}
</script>
<script>
$("#main").hide().load("page/menu.html").fadeIn('1000');
</script>
</main>


Le petit soucis arrive ici, quand je navigue via mon menu (qui fait appel aux autres pages):


<nav id="nav">
<ul>
<li><a href="#"><img src="./img/sc.jpg" onclick="afficher('./page/x1.html')" onMouseOver="this.src='./img/sch.jpg'" onMouseOut=this.src='./img/sc.jpg'></a></li>
<li><a href="#"><img src="./img/in.jpg" onclick="afficher('./page/x2.html')" onMouseOver="this.src='./img/inh.jpg'" onMouseOut=this.src='./img/in.jpg'></a></li>
<li><a href="#"><img src="./img/ha.jpg" onclick="afficher('./page/x3.html')" onMouseOver="this.src='./img/hah.jpg'" onMouseOut=this.src='./img/ha.jpg'></a></li>
<li><a href="#"><img src="./img/ab.jpg" onclick="afficher('./page/x4.html')" onMouseOver="this.src='./img/abh.jpg'" onMouseOut=this.src='./img/ab.jpg'></a></li>
<li><a href="#"><img src="./img/pe.jpg" onclick="afficher('./page/x5.html')" onMouseOver="this.src='./img/peh.jpg'" onMouseOut=this.src='./img/pe.jpg'></a></li>
<li><a href="#"><img src="./img/co.jpg" onclick="afficher('./page/x6.html')" onMouseOver="this.src='./img/coh.jpg'" onMouseOut=this.src='./img/co.jpg'></a></li>
<li><a href="#"><img src="./img/dp.jpg" onclick="afficher('./page/x7.html')" onMouseOver="this.src='./img/dph.jpg'" onMouseOut=this.src='./img/dp.jpg'></a></li>
<li><a href="#"><img src="./img/ch.jpg" onclick="afficher('./page/x8.html')" onMouseOver="this.src='./img/chh.jpg'" onMouseOut=this.src='./img/ch.jpg'></a></li>
</ul>
</nav>


Ma destination se fait correctement, la page en question s'affiche bien. seulement, quand je fais "retour en arrière" via mon navigateur, cela ne marche pas, la page reste statique sans changer le contenu.

Donc, pour moi, la solution serait de faire un historique propre au site, seulement je pense qu'il y aurait des moyens plus simple pour un simple retour en arrière.

Merci pour votre aide !

A voir également:

1 réponse

legiux777 Messages postés 224 Date d'inscription   Statut Membre Dernière intervention   93
 
<a herf="javascript:history.go(-1)">Retour</a>

Cordialement,
Signature non conforme supprimée par la Modération CCM(:
0
the_jb Messages postés 651 Date d'inscription   Statut Membre Dernière intervention   58
 
Ne fonctionne pas avec <a href="javascript:history.go(-1)">Retour</a>

Ok mais via le bouton retour du navigateur ?

à l'event click du bouton retour ou précédent je dois retourner sur l'ancienne page "loadé"
0