Reputation: 423
I apologize if this question has been posted once before, I am a noob to jquery, but It seems like I have part of it working.
I have the code partly working, but when you go to krissales.com, it'll load the page twice, if you see what I mean. I just want it to load once, on fade in, and once on fade out, however it does it twice.
Again, I apologize if this has already been posted. I do appreciate your time. Thank you.
This is the code I have:
function page_load($href) {
if($href != undefined && $href.substring(0, 2) == '#/') {
// replace body the #content with loaded html
$('#content').load($href.substring(2));
$('#content').fadeOut('slow', function() {
$('#content').fadeIn('slow');
});
}
}
the full core is at:
http://www.krissales.com/_lib/_js/core.js
Upvotes: 1
Views: 347
Reputation: 8301
You are doing a slow fadeOut, then fadeIn within the callback. You can try hiding #content within the load() method callback, then chaining a fadeIn() as the final method. For example:
function page_load($href) {
if($href != undefined && $href.substring(0, 2) == '#/') {
// replace body the #content with loaded html
$('#content').load($href.substring(2), function () {
$('#content').hide().fadeIn('slow');
});
}
}
Upvotes: 1