鼠标插入/离开处理程序
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鼠标插入/离开处理程序相关的知识,希望对你有一定的参考价值。
These functions allow you to easily set a handler for a virtual mouseleave/enter event.This requires my [MouseBoundaryCrossing](http://snipplr.com/view/8206/crossbrowser-mouseenterleave-solution/) class.
/**************************************** These functions allow you to easily set a handler for a virtual mouseleave/enter event, using my MouseBoundaryCrossing class. /****************************************/ //Note that a mouseout/over event is always fired before a mouseleave/enter event //Also note that mouseleave/enter events do not bubble; effectively, they don't bubble in this implementation either. //usage: elem.onmouseout = onMouseLeave(leaveHandler, outHandler); //usage: elem.onmouseover = onMouseEnter(enterHandler, overHandler); function onMouseLeave(handleLeave, handleOut) { if(!handleLeave) return handleOut; return function(evt) { evt = evt || window.event; if(handleOut) handleOut.call(this, evt); try{ var mbc = new MouseBoundaryCrossing(evt, this); if(mbc.leftLandmark) handleLeave.call(this, evt); }catch(e){} } } function onMouseEnter(handleEnter, handleOver) { if(!handleEnter) return handleOver; return function(evt) { evt = evt || window.event; if(handleOver) handleOver.call(this, evt); try{ var mbc = new MouseBoundaryCrossing(evt, this); if(mbc.enteredLandmark) handleEnter.call(this, evt); }catch(e){} } }
以上是关于鼠标插入/离开处理程序的主要内容,如果未能解决你的问题,请参考以下文章
C# winfrom程序 dev控件 gridview实现鼠标悬浮变色,离开颜色恢复
android - 离开应用程序时保持谷歌地图片段在位置上放大
[ jquery 文档处理 insertBefore(content) before(content|fn) ] 此方法用于把所有匹配的元素插入到另一个指定的元素元素集合的前面,实现外部插入(代码片段