Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionfunction load_dragdrop(limit){ var drop = $('cart'); var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect, document.max = limit; document.count = 0; document.plan_list = new Array(); document.i = 0; $$('.item').each(function(item){ item.addEvent('mousedown', function(e) { e = new Event(e).stop(); var clone = this.clone() .setStyles(this.getCoordinates()) // this returns an object with left/top/bottom/right, so its perfect .setStyles({'opacity': 0.7, 'position': 'absolute'}) .addEvent('emptydrop', function() { this.remove(); drop.removeEvents(); }).inject(document.body); drop.addEvents({ 'drop': function() { drop.removeEvents(); clone.remove(); if( document.count < document.max ){ item.clone().inject(drop); document.count++; document.getElementById('bar_img').style.width = Math.round( ( document.count / document.max ) * 100 ) + '%'; document.getElementById('bar_img').innerHTML = Math.round( ( document.count / document.max ) * 100 ) + ' %'; dropFx.start('555555').chain(dropFx.start.pass('#252525', dropFx)); document.plan_list[document.i] = item.id; document.i++; } else { alert('La liste de planification est déjà pleine !'); } }, 'over': function() { dropFx.start('555555'); }, 'leave': function() { dropFx.start('252525'); } }); var drag = clone.makeDraggable({ droppables: [drop] }); // this returns the dragged element drag.start(e); // start the event manual }); }); }