Show on click

Show on click

I wrote a script that when a thumbnail is clicked that it will display an image in a separate div. It works but the problem is it switches the new image, fades and then reloads the new image. I want the old image to fade and the new one to fade in.

jquery
  1. $('#portfolioLeft a.thumb').click(function() {
  2. var thumbId = $(this).attr('id');
  3. $('#portfolioRight #portfolioMac img').fadeOut('slow');
  4. $('#portfolioRight #portfolioMac img').attr('src', 'img/port/lrg/' +thumbId+ '.jpg').fadeIn('slow');
  5. });
html
  1. <div id="portfolioLeft">
  2. <a class="thumb" href="javascript:void(0)" id="josephmanning"><img src="img/port/sml/josephmanning.jpg" border="0" alt="" /></a>
  3. <a class="thumb" href="javascript:void(0)" id="omm"><img src="img/port/sml/omm.jpg" border="0" alt="" /></a>
  4. <a class="thumb" href="javascript:void(0)" id="omm-dancer"><img src="img/port/sml/omm.jpg" border="0" alt="" /></a>
  5. </div>
  6. <div id="portfolioRight">
  7. <div id="portfolioMac">
  8. <div id="portfolioPadding">
  9. <img src="img/port/lrg/josephmanning.jpg" border="0" alt="" />
  10. </div>
  11. </div>
  12. </div>

Any help is appreciated.