如何从 jQuery 触发鼠标移动事件
How to trigger a mouse move event from jQuery
我正在尝试使用 jQuery 手动触发mousemove
事件。演示这个小提琴 http://jsfiddle.net/qJJQW/
从堆栈溢出上的其他类似帖子来看,这似乎应该有效。为什么不是呢?
使用 jQuery 绑定 mousemove 事件:
$(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);
}
你更新的小提琴。
jQuery的trigger()
只触发使用jQuery设置的事件处理程序?
$(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);
}
小提琴
相关文章:
- js:停止鼠标移动
- Zingchart-平移键和鼠标移动
- 在鼠标上触发鼠标移动'的当前位置
- 当用户将鼠标移到屏幕/图表上时,自动滚动将暂停.如果鼠标移动停止,自动滚动将再次恢复
- 如何在谷歌地图上用鼠标移动标记
- 如何在鼠标移动事件时更改图像的窗口中心和宽度
- 如何模仿鼠标移动和事件
- 鼠标点击不会'不起作用,鼠标移动可以
- 有没有办法提高鼠标移动的分辨率
- 如何在JS中随机化backgroundPosition而不使用鼠标移动来制作万花筒的动画
- 如何使用onmousemove函数在每次鼠标移动时更改背景图像
- 使用jQuery/CSS设置的鼠标光标在鼠标移动之前不会更改
- 在谷歌地图中用鼠标移动标记
- 在HTML5画布中绘制鼠标移动的半透明线条
- 如何使用Protractor/Senium将鼠标移动到任意点
- 防止鼠标移动对elementFromPoint的攻击
- 如果鼠标悬停得很快,Jquery鼠标移动会错过一些单元格
- 检查人员是否通过鼠标移动离开网站
- 使用鼠标移动操作选择选项
- 如何在D3Javascript中将鼠标移动到节点上时显示和隐藏节点