performance: jquery.live() vs. creating specific listeners on demand?
- by Haroldo
I have a page with news item titles, clicking each one ajax loads a full news items including a photo thumbnail. I want to attach a lightbox to the thumbnails to show a bigger photo.
I have two options (i think):
.live()
.
$('img .thumb').live('click', function())
add a specific id based listener on callback of the news item click
.
$('div.news_item').click(function(){
var id = $(this).attr('id');
//click
show_news_item(),
//callback
function(){$(id+' .thumb').lightbox();}
})