>     var cur =  $( this ).css( 'zIndex');
>     zmax = cur > zmax ? cur : zmax;

You could also say

  zmax = Math.max(zmax, this.style.zIndex);

I *think* should also work to replace that whole block of code, if you
prefer a functional approach:

$( this ).css( 'zIndex',
   Math.max.apply(null, $.map($( this ).siblings( '.draggable' ),
      function(){ return this.style.zIndex })
  );

Reply via email to