Search

12/16/2009

Dom.Point and Region.contains, check if event occus in some div.

http://chunghe.googlecode.com/svn/trunk/experiment/yui.event/event.in.region.htm


Event.on(document.body, 'click', function(e) {
var xy = Event.getXY(e);
var point = new YAHOO.util.Point(xy);
var region = Dom.getRegion('foo');
Dom.get('output').innerHTML = 'click inside? ' + '' + (region.contains(point)? 'true':'false') + '';
});

沒有留言: