鼠标输入事件未触发
MouseEnter event is not firing
我有两个语音气泡每两秒更改一次内容。我尝试每次将鼠标放在气泡上时,我的 changeComment 函数都会停止,这样用户将有更多时间阅读注释,当鼠标离开气泡时,该功能将再次启动。
我这里有我的演示:http://jsbin.com/EMogAfud/1
这是我正在使用的功能
$("bubbleSpeech").mouseenter(function(){
clearInterval(intervalStop);
});
$("bubbleSpeech").mouseleave(function(){
show();
intervalStop=setInterval(show,pause);
});
不太确定为什么它不起作用。我没有收到事件火灾。
提前致谢
你忘了使用'#' :
$("#bubbleSpeech").mouseenter(function(){
clearInterval(intervalStop);
});
$("#bubbleSpeech").mouseleave(function(){
show();
intervalStop=setInterval(show,pause);
});
你缺少#
标识选择器
$("#bubbleSpeech")
^ // added # for id-selector
感谢您的评论它们是执行此操作的两种方法。
使用 Jquery
$("#bubbleSpeech").mouseenter(function(){
clearInterval(intervalStop);
});
$("#bubbleSpeech").mouseleave(function(){
show();
intervalStop=setInterval(show,pause);
});
或者使用纯JavaScript
演示:http://jsbin.com/ejiFixeG/2
mainSlider=document.getElementById('bubbleSpeech');
mainSlider.onmouseenter = function(){
clearTimeout(timerStop) ;
clearInterval(intervalStop);
};
mainSlider.onmouseleave = function(){
show();
intervalStop=setInterval(show,pause);
};
相关文章:
- 是否可以为HTML5输入滑块触发oninput事件
- 使用onkeyup JS事件检查输入的值是否唯一
- 访问代码生成的输入元素上的keyup事件
- 将事件侦听器添加到文档,而不是签入元素存在,然后添加事件侦听器
- 无线电输入更改的jQuery事件未启动
- ajax成功地将数组中的数据放入表中各自的输入中
- 如何获取按钮点击事件输入的当前值
- 检查 jQuery 中的递增-递减事件输入类型编号
- 使用typeahead.js从themoviedb中提取更多信息,并将其放入其他输入中
- Ng-model绑定触摸事件输入的值失败
- 斜面# 39;使用jquery将数字放入文本输入的值中
- 从onkeyup事件输入触发JS函数
- 用于关键事件输入验证的Javascript正则表达式故障排除帮助
- Jquery脚本,将图像映射区域的标题放入文本输入表单
- Jquery在点击事件输入
- 如何检测javascript事件输入的变化
- 更改事件输入字符
- 将复选框中的值放入 html 输入字段中
- 触发多个事件/输入字段的功能并计算它们
- 组合组件上的onBlur事件(输入+按钮)