I'm currently working on my Stretchbox Plugin and trying to optimize and shorten the code. I've used the jquery data method to attach data to certain divs. For instance:
$('#thumbs div:last-child').data('active', true)
which sets a certain div to the active state. If i know want to find this div, i have to check each .thumb class in order to find it:
$('.thumb').each(function() {
if($(this).data('active')){
//Do Stuff
}
}
This works fine, but I'm quite sure there should be a much easier way, since checking up every single .thumb div(out of 10-30) will take some performance too.