我正在使用 jquery 拖放并尝试在拖放后将类添加到 div。添加类在删除之前可以正常工作,但在之后不行。如何访问删除的 div 到 addClass 其中:
function play_vid(){
$("#v1").show();
v1.play();
$("#element_1").addClass('highlighted');
}
紧随其后的是:
function handleElementDrop( event, ui ) {
var slotNumber = $(this).data( 'number' );
var elementNumber = ui.draggable.data( 'number' );
if ( slotNumber == elementNumber ) {
ui.draggable.css( 'cursor', 'pointer' );
setTimeout(function(){
ui.draggable.find('.element_left').click(function(e) {
window.open(ui.draggable.attr('data-link'));
});
});
ui.draggable.parent().find('.info').addClass('correct');
ui.draggable.addClass( 'correct' );
ui.draggable.draggable( 'disable' );
$(this).droppable( 'disable' );
ui.draggable.position( { of: $(this), my: 'left top', at: 'left top' } );
ui.draggable.draggable( 'option', 'revert', false );
slots_filled.push(ui.draggable.data('number'))
if(slots_filled.length == slots){
play_vid();
}
}
}