master
1$(document).ready(function() {
2
3 var hash = window.location.hash.substr(1);
4 var href = $('#nav li#ajax a').each(function(){
5 var href = $(this).attr('href');
6 if(hash==href.substr(0,href.length-5)){
7 var toLoad = hash+'.html #toload';
8 $('#toload').load(toLoad)
9 }
10 });
11
12 $('#nav li#ajax a').click(function(){
13
14 var toLoad = $(this).attr('href')+' #toload';
15 $('#toload').fadeTo('fast',0.00001,loadContent);
16 $('#load').remove();
17 $('#wrapper').append('<span id="load">LOADING...</span>');
18 $('#load').fadeIn('fast');
19 window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
20 function loadContent() {
21 $('#toload').load(toLoad,showNewContent())
22 }
23 function showNewContent() {
24 $('#toload').delay(500).fadeTo('normal',1,hideLoader());
25 }
26 function hideLoader() {
27 $('#load').fadeOut('normal');
28 }
29 return false;
30
31 });
32
33});