简体   繁体   English

Javascript, GWT

[英]Javascript, GWT

I have a hidden component that will be shown only if a mouse pointer is in some area (not necessary on top of the hidden component).我有一个隐藏组件,只有当鼠标指针位于某个区域时才会显示(不需要在隐藏组件的顶部)。 Therefore, I am interested in catching all mouse move event from the browser.因此,我有兴趣从浏览器中捕获所有鼠标移动事件。 Is it posible with GWT, GXT, or with Javascript?是否可以与 GWT、GXT 或 Javascript 一起使用?

Thanks谢谢

Yes it is possible to detect mouse events.是的,可以检测鼠标事件。

For example if you are using jQuery:例如,如果您使用 jQuery:

    $(document).mousemove(function(event){

       var mouseX = event.clientX;
       var mouseY = event.clientY;

       //do something with the X and Y values

    });

Demo: http://jsfiddle.net/maniator/xqULX/演示: http://jsfiddle.net/maniator/xqULX/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM