Using jQuery:
var $activeList = $('.active_list');
var $activeSlide = $activeList.find('.active_list_slide');
var slideIndex = $activeList.children().index($activeSlide);
In the case above, $activeList was used twice. Was it worth it to make it a variable rather than just keeping it as $('.active_list').
My general rule was always that 2 uses of a dynamic variable make it worth it to make a variable (rather than doing the same operation to find it twice). Is this a good philosophy?
Certainly. You’ll avoid what is potentially a lot of code execution behind that query. The only exception is if somehow the result might have changed from one call to the next. Doesn’t seem very likely in this context, though. This is DOM manipulation, not massively concurrent database updates.