[jQuery] DOM Gallery

[jQuery] DOM Gallery

> When the 1st thumbnail is clicked, fadeIn occurs once
> When the 2ndst thumbnail is clicked, fadeIn occurs twice
> When the 3rd thumbnail is clicked, fadeIn occurs three times
> and so on...
> Any ideas why?
Yep, it's attaching a new .load() event each time it goes through showPic().
By moving the event assignment to the initial load the problem should be
eliminated. At that point showPic is only two lines, so you might as well
fold those into the .click() handler and boil it down to 8 lines:

$(function(){
$('div#showcase a').click(function() {
$('#placeholder').hide().attr('src', this.getAttribute ('href'));
$('#description').html(this.getAttribute("title")||"");
return false;
});
$('#placeholder').load(function(){$(this).fadeIn('slow');});
});
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/