Difference between revisions of "Team:ZJU-China/js/globe/ZJU-ajax.js"

(Created page with "$(document).ready(function() { var hash = window.location.hash.substr(1); var href = $('#nav li a').each(function(){ var href = $(this).attr('href'); if(hash==hre...")
 
Line 2: Line 2:
 
   
 
   
 
var hash = window.location.hash.substr(1);
 
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function(){
+
var href = $('#gl-menu div a').each(function(){
 
var href = $(this).attr('href');
 
var href = $(this).attr('href');
 
if(hash==href.substr(0,href.length-5)){
 
if(hash==href.substr(0,href.length-5)){
Line 10: Line 10:
 
});
 
});
  
$('#nav li a').click(function(){
+
$('#gl-menu div a').click(function(){
 
   
 
   
 
var toLoad = $(this).attr('href')+' #content';
 
var toLoad = $(this).attr('href')+' #content';

Revision as of 00:13, 5 September 2015

$(document).ready(function() {

var hash = window.location.hash.substr(1); var href = $('#gl-menu div a').each(function(){ var href = $(this).attr('href'); if(hash==href.substr(0,href.length-5)){ var toLoad = hash+'.html #content'; $('#content').load(toLoad) } });

$('#gl-menu div a').click(function(){

var toLoad = $(this).attr('href')+' #content'; $('#content').hide('fast',loadContent); $('#load').remove(); $('#wrapper').append('LOADING...'); $('#load').fadeIn('normal'); window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5); function loadContent() { $('#content').load(toLoad,,showNewContent()) } function showNewContent() { $('#content').show('normal',hideLoader()); } function hideLoader() { $('#load').fadeOut('normal'); } return false;

});

});