...

View Full Version : Callback function executing immediately



Jimather
02-12-2011, 06:02 PM
This question has appeared in a similar form in another thread however that issue was fixed only to present a slightly different one.

The problem is, the callback function is executing immediately rather than waiting for the fadeout to finish, any ideas ?



function loadBlog(){

$('#contentBox').fadeOut(1800,function(){

var html = $.ajax({
url: "includes/blog.php",
async: false,
success: function(html) {

document.getElementById('content').innerHTML = html;
document.getElementById('contentBox').setAttribute("display", "none");
$('#contentBox').fadeIn(2000);
}
}).responseText;
});
};

Jimather
02-14-2011, 12:44 AM
So interestingly firefox does not have a problem, everything works perfectly.

Chrome will still not fadeout but does fadein and IE does not do any fading at all and simply immediately loads and displays the page.

This is driving me crazy :mad:

venegal
02-14-2011, 01:37 AM
Can you show that on a live site?

Jimather
02-14-2011, 01:43 AM
Yeah sure its right here http://nomoredrilling.org.uk/Alexanders/index.php

venegal
02-14-2011, 02:33 AM
Apparently there is a problem with fading inline elements and/or fading elements that have no size.

So, giving the #contentBox "display: block" instead of "display: inline" might solve your problem.

Jimather
02-14-2011, 10:47 AM
Well that has fixed things in chrome but still no joy in IE.

Interestingly I did have it working in IE, but the function was badly structured in that it was actually calling itself three times, which was causing some issues with the contact form submission so I altered that and now I have this problem.

venegal
02-14-2011, 05:02 PM
If you don't feel like tracking down the error, you could fade $('.content') instead.

Jimather
02-15-2011, 08:49 AM
Hmmm yes, I might just go back to the old crappy slightly broken but somehow working for IE way. Hot dang.

Thanks for your help anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum