- 浏览: 399644 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
Previously we discussed javascript - trick to handlers management for add/remove custom events. and
javascript - trick to detect bubbling supportability to test if a certain event is supported in certain (actually the current) browser.
mouseenter and mouseleave ae are two custom events that is introduced by IE, while it has superiority in determing if the mouse is and only is within the target element.
the counterparts, mouseover and mouseout has limitation in that it will falsifly fire if the mouse is within child elemnts of the target element.
below is the code that simulate the mouseenter and mouseleave event with the help of previous discussed addremoveevents and event supportability detects.
/************************************** *@Name: mouses.js * Mouse enter and MouseLeave event are more easier to use to determine when the mouse is currently positioned within an elment, or outside it. *@Summary * there are conterparts in almost every browser, which is called mouseover and mouseout; the problem with them is that * @NOTE: * this has dependencies on other js files * 1. isEventSupported.js * 2. addremoveevents.js * @todo: * Test and add them to the docs ***************************************/ (function () { if (isEventSupported("mouseenter")) { this.hover = function(elem, fn) { addEvent(elem, "mouseenter", function() { fn.call(elem, "mouseenter"); }); addEvent(elem, "mouseleave", function() { fn.call(elem, "mouseleave"); }); }; } else { this.hover = function(elem, fn) { addEvent(elem, "mouseover", function(e) { withinElement(this, e, "mouseenter", fn); }); addEvent( elem, "mouseout", function(e){ withinElement( this, e, "mouseleave", fn ); }); }; } function withinElement(elem, event, type, handle) { // Check if mouse(over|out) are still // within the same parent element var parent = event.relatedTarget; // this is non-ie, but the event withinEvent is mean to work on non-ie only // Traverse up the tree while (parent && parent != elem) { // Firefox sometimes assigns relatedTarget a XUL element // which we cannot access the parentNode property of try { parent = parent.parentNode; } catch (e) { break; } } if (parent != elem) { // handle event if we actually just // mouse oon to a non sub-element handle.call(elem, type); } } })();
below is the code that hows you how to use it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <!-- mouses.html to test mouses.js --> <script type="text/javascript" src="addremoveevents.js"></script> <script type="text/javascript" src="isEventSupported.js"></script> <script type="text/javascript" src="mouses.js"></script> <script type="text/javascript"> window.onload = function () { var div = document.getElementsByTagName('div')[0]; // the hover event is defined in .js mouses.js file hover(div, function (type) { if (type === "mouseenter") { this.className = "over"; } else { this.className = ""; } }); }; </script> </head> <body> <div>Hover <strong>over</strong> me!</div> <style>.over { background: yellow; }</style> </body> </html>
发表评论
-
javascript - trick to cross browser DOM ready event
2012-08-24 08:23 926the "ready" event ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1657In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 904In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 699Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 971Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2076In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 1023We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 817For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 879Many browsers, especially In ... -
javascript - tricks to deal with colors
2012-08-15 08:34 765There are a couple of ways to r ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 765All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 520though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 548when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 515When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 745while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 531IE is again the only browser th ... -
javascript - trick IE form and its expando attribute
2012-08-16 10:59 1040there is a known issue that if ... -
javascript expando and attributes
2012-08-14 08:15 1037expando is something like this ... -
javascript - trick to getText and setText
2012-08-14 07:40 1143it is not as simple as you thin ... -
javascript - trick/guideline to remove DOM element
2012-08-14 07:00 1176remove an element is not as sim ...
相关推荐
matplotlib-3.6.3-cp39-cp39-linux_armv7l.whl
numpy-2.0.1-cp39-cp39-linux_armv7l.whl
基于springboot个人公务员考试管理系统源码数据库文档.zip
onnxruntime-1.13.1-cp310-cp310-win_amd64.whl
基于springboot的西山区家政服务网站源码数据库文档.zip
Linux环境下,关于C++静态库的封装和调用代码。 TestLib是库目录。 TestLibCall是调用库的目录。
基于springboot软件技术交流平台源码数据库文档.zip
numpy-1.20.1-cp39-cp39-linux_armv7l.whl
ASP.NET酒店管理系统源码(WPF) 一、源码特点 采用WPF进行开发的酒店管理系统源码,界面相当美观,功能齐全 二、菜单功能 1、预订登记:可选择入住时间、离店时间、所在城市、证件类型,保存、删除、查询、返回 2、住宿结算:新增入住、保存、删除、查询、返回 3、今日盘点:查询、返回 4、查询统计: 5、房间管理:增加房间类型、删除类型、增加房间、删除房间、保存、返回 6、用户管理:增加用户、删除用户、保存、返回 7、系统配置:基本功能 8、显示当前系统时间等功能的实现
坠落的天空小游戏图片和代码
论文描述:该论文研究了某一特定领域的问题,并提出了新的解决方案。论文首先对问题进行了详细的分析和理解,并对已有的研究成果进行了综述。然后,论文提出了一种全新的解决方案,包括算法、模型或方法。在整个研究过程中,论文使用了合适的实验设计和数据集,并进行了充分的实验验证。最后,论文对解决方案的性能进行了全面的评估和分析,并提出了进一步的研究方向。 源码内容描述:该源码实现了论文中提出的新的解决方案。源码中包含了算法、模型或方法的具体实现代码,以及相关的数据预处理、实验设计和性能评估代码。源码中还包括了合适的注释和文档,以方便其他研究者理解和使用。源码的实现应该具有可读性、可维护性和高效性,并能够复现论文中的实验结果。此外,源码还应该尽可能具有通用性,以便在其他类似问题上进行进一步的应用和扩展。
环境说明: 开发语言:python Python版本:3.6.8 数据库:mysql 5.7 数据库工具:Navicat11 开发软件:pycharm
基于springboot高校学术交流平台源码数据库文档.zip
onnxruntime-1.16.2-cp310-cp310-win_amd64.whl
基于springboot+vue的实践性教学系统源码数据库文档.zip
基于springboot的校园二手物品交易系统源码数据库文档.zip
numpy-1.23.5-cp39-cp39-linux_armv7l.whl
bimdata_api_client-4.0.2-py3-none-any.whl
环境说明: 开发语言:PHP 框架:原生php/thinkphp5 服务器:Apache 数据库:mysql 5.7(一定要5.7版本) 数据库工具:Navicat 11 运行软件:小皮phpStudy
基于SpringBoot的中老年人文化活动平台源码数据库文档.zip