Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    66
    Thanks
    10
    Thanked 5 Times in 5 Posts

    Callback function executing immediately

    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 ?

    Code:
    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;
    		}); 
            };

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    66
    Thanks
    10
    Thanked 5 Times in 5 Posts
    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

  • #3
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Can you show that on a live site?

  • #4

  • #5
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    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.

  • #6
    New Coder
    Join Date
    Jan 2011
    Posts
    66
    Thanks
    10
    Thanked 5 Times in 5 Posts
    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.

  • #7
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    If you don't feel like tracking down the error, you could fade $('.content') instead.

  • #8
    New Coder
    Join Date
    Jan 2011
    Posts
    66
    Thanks
    10
    Thanked 5 Times in 5 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •