我试图使用jQuery手动触发mousemove
事件。请看这个示例http://jsfiddle.net/qJJQW/
从其他类似的Stack Overflow帖子上看,应该可以工作,为什么它不起作用呢?
我试图使用jQuery手动触发mousemove
事件。请看这个示例http://jsfiddle.net/qJJQW/
从其他类似的Stack Overflow帖子上看,应该可以工作,为什么它不起作用呢?
$(function () {
$("#test").on("mousemove", youCantHandleTheFunc);
$('#button').click(function () {
$('#test').trigger('mousemove', {type:'custom mouse move'});
});
});
function youCantHandleTheFunc (e,customE) {
if (customE != undefined) {
e = customE;
}
$('#result').html(e.type);
}
$(function(){
$('#test').on('mousemove', youCantHandleTheFunc);
$('#button').click(function(){
$('#test').trigger('mousemove',{type:'custom mouse move'});
});
});
function youCantHandleTheFunc(e,customE){
if (customE!=undefined){
e=customE;
}
$('#result').html(e.type);
}