Hide and Seek via Mouse

In: web resources

2 Oct 2009

It’s always nice when a basic shared idea with a simple proof of concept becomes something concrete, usable, and well explained. This is the case with Shea Frederick’s post titled Forwarding Mouse Events Through Layers.

The aim of the technique is to provide an ExtJS plug-in that can capture dragged and dropped data from external sources, such as a spreadsheet, in order to easily import data inside a generic Ext.grid.GridPanel.

  1. The textarea (my masking element) that is positioned over the grid receives mouseover, mousemove, mousedown , mouseup and other events.
  2. The top masking layer is hidden for a moment, so we can figure out what element is below the mask at the event location.
  3. The event is re-fired – this is where the W3 DOM Event model and the simpler Microsoft equivalent come into play.
  4. Start the process again – ready for the next event.

The method used to understand which element is supposed to be the event target is document.elementFromPoint, also compatible with IE, Mozilla, WebKit, and Opera.

The technique does not necessarily need the ExtJS library but this demo shows a live Ext Grid example.

Go to Source

2 Responses to Hide and Seek via Mouse

Avatar

Kasey C

January 19th, 2010 at 3:32 am

What don't you understand about them?

If mouse goes over a button, or a form, or a field, an event occurs. If there's a buttonclick some OTHER event occurs. Same with keyboard. What's not to understand about them?

Avatar

Goliath

February 16th, 2010 at 8:37 am

There's a Pokemon worldwide tornament locator, on the link provided.

Comment Form

About this blog

This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.