1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| // navigation ajax
$('#menuPrincipal ul li a').click(function(){
var $this=$(this);
var page=$this.attr('href').substr(8);
var contenu=$('div#contenu');
contenu.insertBefore('en chargement...');
if(page!='')
{
$('#menuPrincipal ul li a').css('fontWeight','normal').each(function(){
$this.css({fontWeight:'bold'});
});
$.ajax({
url:page+'.php',
data:'#'+page,
type:'POST',
global:true,
cache:false,
dataType:'html',
contentType:'text/html',
success:function(reponse){
/*
contenu
.animate({opacity:'toggle',height:'toggle'}, 'normal', function(){
contenu.animate({opacity:'toggle',height:'toggle'}, 'normal')
.html(reponse);
});
*/
contenu.fadeTo(200,0,function(){
contenu.html(reponse).fadeTo(200,1);
});
}
});
// mise à jour de l'ancre
var lien=document.location.href;
var lien=lien.replace(/^.*#\//, '');
//suppression des caractères #/
var updateHash=document.location.hash=page;
//alert(updateHash);
}
$this.blur();
return false;
}); |
Partager