我有一个带有打印按钮的拖放项目,一个按原样打印页面(在用户拖放任何内容之前),另一个我在加载时使用 JavaScript 禁用。在所有可拖动对象被删除后,如何激活第二个按钮?
$(document).ready(function() {
$(".ui-widget-content").draggable({ revert: 'invalid', cursor: 'move', snapTolerance: '0px' }),
$("#dropcrown").droppable({ accept: '#crown'});
$( "#dropneck" ).droppable({ accept: '#neck' });
$( "#dropback" ).droppable({ accept: '#back' });
$( "#droptail" ).droppable({ accept: '#tail' });
$( "#dropwing" ).droppable({ accept: '#wing' });
$( "#dropeye" ).droppable({ accept: '#eye' });
$( "#dropbeak" ).droppable({ accept: '#beak' });
$( "#dropcheek" ).droppable({ accept: '#cheek' });
$( "#dropbreast" ).droppable({ accept: '#breast' });
$( "#dropbelly" ).droppable({ accept: '#belly' });
$( "#dropfoot" ).droppable({ accept: '#foot' });
$('#button2', this).attr('disabled', 'disabled');
$('#button2', this).addClass( "ui-state-disabled" );
});
$(document).ready(function() {
$( "#dropcrown, #dropneck ,#dropback, #droptail, #dropwing, #dropeye, #dropbeak, #dropcheek, #dropbreast, #dropbelly, #dropfoot" ).droppable({tolerance:'touch',
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" );
var dropped = ui.draggable;
var droppedOn = $(this);
$(dropped).detach().css({top: 15,left: 7}).appendTo(droppedOn);
$('#button', this).attr('disabled', 'disabled');
$('#button', this).addClass( "ui-state-disabled" );
}
});
});
$(document).ready(function() {
if($('#labels').html() == ""){
$('#button2', this).removeAttr('disabled', 'disabled');
$('#button2', this).removeClass( "ui-state-disabled" );
//do something
}
});