Text 1 Apr 4 notes Dragging elements

We have two lists. Total and associated elements. The main problem with ie is z-index. If we are dragging one element into other list we want to show this element over-all the rest. We have to control this, asking who is dragging what: // First of all, we bind elements to be sortable (with jquery-ui)

     $( ".all_elements, .associated_elements" ).sortable({
     			connectWith: ".sortable",cursor: 'pointer',opacity: 0.6,placeholder:'ui-state-highlight'
     		}).disableSelection();
// And we have to control zindex of each element (specially in IE6) with sortstart event
     $( ".sortable" ).bind( "sortstart", function(event, ui) {
          if ($(this).hasClass('all_elements')){
            $('.associated_elements').parent().css('zIndex','0');
            $('.associated_elements').css('zIndex','1');
            
            $('.all_elements').parent().css('zIndex','2');
            $('.all_elements').css('zIndex','3');
            
          }else {
            $('.all_elements').parent().css('zIndex','0');
            $('.all_elements').css('zIndex','1');
            
            $('.associated_elements').parent().css('zIndex','2');
            $('.associated_elements').css('zIndex','3');
            
          }
        }); 		    

  1. rabarroso posted this

Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.