here is my code:
$("a").live('click', function(){
history.pushState({}, '', this.href);
popstate(this.href);
$("#loadpage").css("display", "block");
return false;
});
popstate = function(url){
url = '/ajaxlinks/ajaxlink'+window.location.pathname.substr(1);
if (url == '/ajaxlinks/ajaxlink'){url = '/ajaxlinks/ajaxlinkindex.php'}
if (url.indexOf(".php") == -1){url = '/ajaxlinks/ajaxlinkprofile.php'}
if (url == '/ajaxlinks/ajaxlinkaccountrecovery.php'){window.location = 'http://www.pearlsquirrel.com/accountrecovery.php';}
if (url == '/ajaxlinks/ajaxlinklogin.php'){window.location = 'http://www.pearlsquirrel.com/login.php';}
if (url == '/ajaxlinks/ajaxlinklogout.php'){window.location = 'http://www.pearlsquirrel.com/logout.php';}
$('#ajaxloadcontent').load(url);
$('html, body').animate({scrollTop:0}, 'fast');
}
$(document).load(function(){
window.onpopstate = function(event){
popstate(window.location.href);
event.preventDefault();
}
});
When clicking on a link, I start this bit of code to show the loading div:
$("#loadpage").css("display", "block");
However, I don’t know where to put the bit of code that displays this div as none:
$("#loadpage").css("display", "none");
I have tried putting this bit of code everywhere, and I just can not seem to get it to work. If anyone knows where I should put this code and maybe if I should even use different syntax, the help would be greatly appreciated.
Probably in the
.loadcallback.You can just use the shorthand
.showand.hidenotation to show/hide a div.