raw.js 805 B

12345678910111213141516171819202122232425262728293031
  1. /* reverseOrder : jQuery order reverser plugin
  2. *
  3. * Written by Corey H Maass for Arc90
  4. * (c) Arc90, Inc.
  5. *
  6. * http://www.arc90.com
  7. * http://lab.arc90.com/2008/05/22/jquery-reverse-order-plugin/#licensing
  8. *
  9. * Licensed under:
  10. * Creative Commons Attribution-Share Alike 3.0 http://creativecommons.org/licenses/by-sa/3.0/us/
  11. *
  12. * Gotta love a plugin with more comments than actual code. :-)
  13. * items need to all be in the same parent like:
  14. * <div>
  15. * <div class="item">item 1</div>
  16. * <div class="item">item 2</div>
  17. * <div class="item">item 3</div>
  18. * </div>
  19. *
  20. * Then call the plugin with the items to reverse:
  21. * $('.item').reverseOrder();
  22. *
  23. */
  24. (function($) {
  25. $.fn.reverseOrder = function() {
  26. return this.each(function() {
  27. $(this).prependTo( $(this).parent() );
  28. });
  29. };
  30. })(jQuery);