Take the 2-minute tour ×
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

closed as off-topic by Malachi, Brian Reichle, Simon André Forsberg, rolfl, Glenn Rogers Nov 19 '13 at 23:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must include the code you want reviewed. Code must not appear only in a link to an external source. Doing so makes us dependent on a third party and makes it harder to review your code. If your code is very large, please select only the portions in which you are especially interested in a review. You are encouraged to keep the link to the rest of your code." – Malachi, Brian Reichle, Simon André Forsberg, rolfl, Glenn Rogers
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
please add more of your code so we can follow along –  Malachi Nov 19 '13 at 20:20

Browse other questions tagged or ask your own question.