html - Jquery drag + drop issue -


i have following jsfiddle code (link below) . having problems fixing the items can dragged within white box area.

scenario: user 1 box base , other user boxes should within user 1 white content div. if instance drag user 4 user 2 user 4 should within white content box of user 2 , on. @ moment drag grey part of user 2 box.

any ideas on how setup divs?

i know html setup can't think of how fix

https://jsfiddle.net/euf1s9gc/3/

'use strict'   $(document).ready(function(){  var resp =[{"id":"1","name":"user","title":"1","parentid":"9","base":"1"},   {"id":"2","name":"user","title":"2","parentid":"1","base":"0"}, {"id":"3","name":" user","title":"3","parentid":"1","base":"0"}, {"id":"4","name":"user","title":"4","parentid":"1","base":"0"}];  createlist(resp); setdragdrop();   function createlist(data){  jquery.each(data, function() {      var baseused =false;     if(this.base == 1 && baseused ==false){          //problem in setup  of html         $('.containers').append("<div class='popup' id='parentid_"+this.id+"'><div class='header'>"+this.name+" ("+this.title+")</div><div class='content'></div></div>");          baseused = true;//to stop replication      }else{          $('#parentid_'+this.parentid).append("<div id='parentid_"+this.id+"' class='popup'><div class='header'>"+this.name+" ("+this.title+")</div><div class='content'></div></div>");     }  });  }  function setdragdrop(){       $('.containers .popup').droppable({         activeclass: "ui-state-default",         hoverclass: "ui-state-hover",       //  accept: '.object',         out: function() {             $( ).droppable( "option", "disabled", false );          },         drop: function(event, ui) {              var targetid = this.id;             var userid = (ui.draggable).get(0).id;              $(ui.draggable).addclass("insidepopup");             ui.draggable.detach().appendto($(this));         }     });       $('.popup').draggable({         helper: 'clone',         containment:"parent"     }); } }); 

i have managed fix droppable part, drops within .content need figure out setup part.

code modified $('.containers .popup .content').droppable({


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -