Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Here is an example of what I have already

The main functionality works, but now I need to make the controller list smaller, so that it fits better to the screen, as it's fixed positioned.

So, I think it should show next three list-items from active item and 2 previous ones.

Something like this would work, but I think there should be shorter and more convinient way:

//Display closest items
$('#historyController li.active').prevAll('li:not(.first)').hide().slice(0,2).show();
$('#historyController li.active').nextAll('li:not(.last)').hide().slice(0,3).show();

Any tips for re-factoring current code for better performance would be helpful as well.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.