Code as reference:
http://jsbin.com/aboca3/2/edit
In this example above (thank you SLaks) I am truncating long unordered lists and providing a toggle link to view the entire thing.
The issue, from a usability standpoint, is that as a full list, it is best sorted alphabetically, which will be the default sort order (the source order). As a short/truncated list, they are most usefully ordered by the magnitude these options will effect the results, in this case the number in the <em>
element.
So working with the code I already have, I would like to re-order the list numerically by <em>
element (highest to lowest), and then when the list is toggled, re-order it alphabetically/numerically based on toggle stat开发者_开发技巧e.
I'm having a hell of a time trying to wrap this in to an associative array so I'd love a fresh perspective on how to handle this.
Thank you!
This should do it for you: http://jsbin.com/aboca3/5/edit
Using petersendidit's code I was able to acheive exactly the result I was looking for. You can view it here:
http://jsbin.com/aboca3/7/edit
精彩评论