我在使用 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
}
});