I need to programmatically fire the click event, which is handled by jQuery. Here's the current code:
var $thumbs = $('#PhotoGalleryThumbs .tile');
var $zoom = $('#PhotoGallery #PhotoGalleryZoom img');
var $description = $('#PhotoGallery #PhotoGalleryDescription');
$thumbs.click(function(event) {
event.preventDefault();
var $thumb = $(this);
$thumb.addClass('selected')
.siblings().removeClass('selected');
$zoom.attr('src', $thumb.children('a').attr('href'));
$description.html($thumb.find('img').attr('alt'));
});
I have a mental block defining how to create a function from the event processing code, and then arbitrarily call it for an element in the object $thumbs.
Sonny source
share