jQuery - Call function when dropping div
I want to run function insertHouse()
when dropping div#Draggable. I can't manage to make it work. You can see me trying to call it in the second line from the bottom. What am I doing wrong?
<img src="images/door1.jpg" id="draggable">
<div id="items"></div>
// Place house;
function insertHouse()
{
blablabla
}
$( init );
function init() {
$('#makeMeDraggable').draggable();
$('body').droppable( {
drop: handleDropEvent
} );
}
function handleDropEvent( event, ui ) {
function insert开发者_C百科House();
}
Following code will work...
function init() {
$('#makeMeDraggable').draggable();
$('body').droppable( {
drop: function(event, ui){
insertHouse();
}
} );
}
精彩评论