title: javascript synchronous execution
body: <p>I am new to javascript and trying on a slider.My problem is similar to the below question
  <a href="https://stackoverflow.com/questions/4040712/jquery-attr-with-callback">jquery .attr() with callback?</a>. If the flow is synchronous, shouldnt the display be delayed till the source is fully loaded rather than showing the old image</p>
  
  <pre><code>$('.container').fadeOut(100, function(){
       console.log("before");
       $('.container &gt; img').attr('src', 'image src');
       $('.container').show();
       console.log("after");
   });
  </code></pre>
  
  <p>I could see both the logs in the console before the new image gets loaded.. Can anyone pls explain...Pls pardon if the question is naive I am trying to get hold of the concept.. </p>