Difference between revisions of "Team:ZJU-China/js/globe/ZJU-ajax.js"
Line 6: | Line 6: | ||
if(hash==href.substr(0,href.length-5)){ | if(hash==href.substr(0,href.length-5)){ | ||
var toLoad = hash+'.html #page-content-wrapper'; | var toLoad = hash+'.html #page-content-wrapper'; | ||
− | jQuery('#page-content-wrapper').load(toLoad) | + | var toLoad1= hash+'.html #popView2'; |
+ | jQuery('#page-content-wrapper').load(toLoad); | ||
+ | jQuery('#popView2').load(toLoad1); | ||
} | } | ||
}); | }); | ||
Line 12: | Line 14: | ||
jQuery('#nav li a').click(function(){ | jQuery('#nav li a').click(function(){ | ||
− | var iWidth = document.documentElement.clientWidth | + | var iWidth = document.documentElement.clientWidth; |
var iHeight = document.documentElement.clientHeight*5; | var iHeight = document.documentElement.clientHeight*5; | ||
var bgObj = document.createElement("div"); | var bgObj = document.createElement("div"); | ||
Line 19: | Line 21: | ||
var toLoad = jQuery(this).attr('href')+' #page-content-wrapper'; | var toLoad = jQuery(this).attr('href')+' #page-content-wrapper'; | ||
+ | var toLoad1 = jQuery(this).attr('href')+' #popView2'; | ||
jQuery('#page-content-wrapper').hide('fast',loadContent); | jQuery('#page-content-wrapper').hide('fast',loadContent); | ||
+ | jQuery('#popView2').hide('fast',loadContent); | ||
jQuery('#load').remove(); | jQuery('#load').remove(); | ||
jQuery('#wrapper').append('<span id="load">LOADING...</span>'); | jQuery('#wrapper').append('<span id="load">LOADING...</span>'); | ||
Line 25: | Line 29: | ||
window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5); | window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5); | ||
function loadContent() { | function loadContent() { | ||
− | jQuery('#page-content-wrapper').load(toLoad,'',showNewContent()) | + | jQuery('#page-content-wrapper').load(toLoad,'',showNewContent()); |
+ | jQuery('#popView2').load(toLoad1,'',showNewContent()); | ||
} | } | ||
function showNewContent() { | function showNewContent() { | ||
jQuery('#page-content-wrapper').show('normal',hideLoader()); | jQuery('#page-content-wrapper').show('normal',hideLoader()); | ||
+ | jQuery('#popView2').show('normal',hideLoader()); | ||
} | } | ||
function hideLoader() { | function hideLoader() { |
Revision as of 10:07, 7 September 2015
jQuery(document).ready(function() {
var hash = window.location.hash.substr(1); var href = jQuery('#nav li a').each(function(){ var href = jQuery(this).attr('href'); if(hash==href.substr(0,href.length-5)){ var toLoad = hash+'.html #page-content-wrapper'; var toLoad1= hash+'.html #popView2'; jQuery('#page-content-wrapper').load(toLoad); jQuery('#popView2').load(toLoad1); } });
jQuery('#nav li a').click(function(){
var iWidth = document.documentElement.clientWidth; var iHeight = document.documentElement.clientHeight*5; var bgObj = document.createElement("div"); bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:998;"; document.body.appendChild(bgObj);
var toLoad = jQuery(this).attr('href')+' #page-content-wrapper'; var toLoad1 = jQuery(this).attr('href')+' #popView2'; jQuery('#page-content-wrapper').hide('fast',loadContent); jQuery('#popView2').hide('fast',loadContent); jQuery('#load').remove(); jQuery('#wrapper').append('LOADING...'); jQuery('#load').fadeIn('normal'); window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5); function loadContent() { jQuery('#page-content-wrapper').load(toLoad,,showNewContent()); jQuery('#popView2').load(toLoad1,,showNewContent()); } function showNewContent() { jQuery('#page-content-wrapper').show('normal',hideLoader()); jQuery('#popView2').show('normal',hideLoader()); } function hideLoader() {
setTimeout(function() { jQuery('#load').fadeOut('normal'); document.body.removeChild(bgObj); }, 1000);
} return false;
});
});