Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drag and drop one div to many divs

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
0
0
GB
I would like to drg n drop a div with width 60px (ccarcellbook) onto 3 divs with width 20px (ccarcell). Have got basic d n d function so that the big div replaces one of small divs, but dont know how to replace 3 small divs

Code:
$('.ccarcellbook').draggable({
  helper:"clone",
  cursor: "move",
  snap:'.ccarcell', 
  snapMode:'inner'
});
$('.ccarcell').droppable({
  over: function(event, ui) {var $this = $(this)},
  drop:function(event, ui) {
  ui.draggable.detach().appendTo($(this));
  }
});

HTML:
<div class="ccarcell"></div>
<div class="ccarcell"></div>
<div class="ccarcell"></div>
<div class="ccarcellbook>DRAG ME</div>
<div class="ccarcell"></div>
<div class="ccarcell"></div>
<div class="ccarcell"></div>

any advice welcome
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top