javascript - Targetting specific div through class with jquery draggable/droppable -


when dragging div using jquery ui , dropping ui droppable div, want trigger jquery animation on div being dropped area. when animation triggered, called on divs class = "drag-element" want specific dragged , dropped element animated. have tried including removeclass(".drag-element") , addclass(".animate-element") , telling animate() act on still applying animation .drag-element divs. how do fix this?

jquery:

$(function() { $( ".drag-element" ).draggable({ containment: ".container" }).removeclass(".drag-vid"); $( ".drop-field" ).droppable({   drop: function( event, ui ) {     $(".drag-element").animate({"left": "+=50px"}, "slow");     $( )       .css("background-color", "silver");   } }); }); 

http://jsfiddle.net/nbhmt/

use:

ui.draggable.animate({"left": "+=50px"}, "slow"); 

instead of:

$(".drag-element").animate({"left": "+=50px"}, "slow"); 

http://jsfiddle.net/kag6q/

what happened code when call $(".drag-element").animate(.... selects drag-element divs. instead drop function has ui argument provides information dragged element using ui.draggable


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -