Created
July 10, 2012 15:07
-
-
Save zeuxisoo/3083901 to your computer and use it in GitHub Desktop.
011_jQuerySite_Modified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function($) { | |
$(function() { | |
var hash = window.location.hash.substr(1); | |
var href = $('#nav li a').each(function(){ | |
var href = $(this).attr('href'); | |
if(hash==href.substr(0,href.length-5)){ | |
var toLoad = hash+'.html #content'; | |
$('#content').load(toLoad) | |
} | |
}); | |
$('#nav li a').click(function(){ | |
var target_content = $(this).attr('href')+' #content'; | |
$('#content').hide(); | |
$('#load').remove(); | |
$('#wrapper').append('<span id="load">LOADING...</span>'); | |
$('#load').fadeIn('normal'); | |
$('#content').load(target_content, function() { | |
$('#content').show(); | |
$('#load').fadeOut('normal'); | |
}); | |
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5); | |
return false; | |
}); | |
}); | |
}(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment