# Refactoring jquery timeline code [closed]

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.

-

## closed as off-topic by Malachi, Brian Reichle, Simon André Forsberg, rolfl♦, Glenn RogersNov 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.