Sortable Divider

Sortable Divider

Here's the dilemma. I have a sortable list that works perfectly. I want to add a draggable divider (like a styled hr tag) in the sortable list. So this divider can be moved between sortables but not part of them. This would not be part of the sortable accepted items. This is what I've been playing with. It sorta works and the helper get appended after the closest element, but the style of the helper gets thrown off as is placed wrong. Any thoughts of an easier way?

  1. $('.hr').draggable({
  2. containment: 'parent',
  3. axis: 'y',
  4. zIndex: 999999,
  5. start: function( event, ui ) {
  6. //ui.helper.detach();
  7. },
  8. stop: function( event, ui ) {
  9. var elements = $('.sortables);
  10. var target = ui.offset.top;
  11. var closestEl;
  12. elements.each(function(index, element) {
  13. el = elements.eq(index);
  14. id = elements.eq(index).attr('id');
  15. if(el.offset().top < target){
  16. closestEl = id;
  17. }
  18. });
  19. //alert(ui.helper.html());
  20. //ui.helper.detach();
  21. $('#' + closestEl).after(ui.helper);
  22. //alert(closestEl);
  23. //$('.marker-wrap').draggable();
  24. }
  25. });