Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 1.15 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jquery sortable does not work as expected
  2. .containerClass{
  3.   float: left;
  4.   width: 42.55em;
  5.   padding: 0.6em 1em 0.3em 0.95em;
  6. }
  7.  
  8. .uploadedPicture {
  9.   float: left;
  10.   border-style: double;
  11.   padding: 1px;
  12.   margin: 0.2em 0.2em 0.2em 0.2em;
  13.   cursor: move;
  14. }
  15.        
  16. $("#pictureContainer").sortable({cursor: "move", distance: 10,  helper: 'original', items: 'img', opacity: 0.4});
  17.  
  18. new AjaxUpload('pictureContainer', {
  19.     action: 'upload.php',
  20.     name: 'picture',
  21.     responseType: false,
  22.     autoSubmit: true,
  23.     onComplete: function(file, response) {
  24.       picContainer = $('#pictureContainer');
  25.           pictures = picContainer[0].childNodes.length;
  26.           container = document.createElement('div');
  27.       container.innerHTML = response;
  28.       for (var i = 0; i < container.childNodes.length; i++) {  // one child
  29.             child = container.childNodes[i];
  30.             child.id = "picture" + pictures++;
  31.             picContainer.append(child);
  32.             $("#pictureContainer").sortable("refresh");
  33.       }
  34.     }
  35. });
  36.        
  37. <div id="pictureContainer" class="containerClass">
  38. </div>
  39.        
  40. <img class="uploadedPicture" alt="" src="'.$picturePath.'" width="150" height="150"/>