jquery トリガー関数で追加パラメーターを渡すときに問題が発生しました。余分なパラメータが渡されていません。コード :
//click event binding with button goes here
$("#b").bind({ click:
function (e, x, y) {
alert(x + " " + y); //here`s the problem, showing undefined (expecting top & left
} //offset() of dropped button
});
//here making the button draggable for drag drop functionality (applying jquery-ui)
$("#b").draggable({ helper : "clone" });
//here creating a droppable area ( here i am dropping a draggable button)
$(".droppable").live({ mouseenter: function () {
$(this).droppable({
accept: "#b", // accepting only button whose id = b
drop: function (ev, ui) {
alert("dropped"); //alert is showing means droppable works fine
var y = ui.offset.top;
var x = ui.offset.left;
ui.draggable.trigger("click", [x , y]); // here i am triggering the click event
} // for button and passing x and y as an
}); // extra parameter
}
});