2012-02-26 116 views

回答

1

假設一些HTML結構如下..

<div class="draggable-container"> 

    <div class="close"> 
    </div> 

</div> 

.draggable-container 
{ 
    position:relative; 
} 

.close 
{ 

    position:absolute; 
    left:10px; 
    top:10px; 
    cursor:pointer; 

} 

$('.draggable-container .close').click(function(){ 
    //implement close here 
    // eg: $(this).closest('.draggable-container').fadeOut(); 
}); 
2

只是一個例子:

$(<your draggable objects selector>).append('<div class="close">close</div>'); 
$('.close', <your draggable objects selector>).click(function() { 
    $(this).parent().remove(); 
});