Google Maps APIã§éãã§ã¿ã ãã®2
Google Map APIã§ã¯GEventãªãã¸ã§ã¯ãã«ãªã¹ãã¼ãç»é²ãããã¨ã«ãã£ã¦ã¤ãã³ãå¦çãè¡ããã¨ãã§ãã¾ãã
Google Maps API Documentation - Event Listeners
GEvent.addListener(source, eventName, function(){ ... }); GEvent.bind(source, eventName, object, function(){ ... });
sourceã«ã¤ãã³ãããªãã¹ã³ãã対象ã®ãªãã¸ã§ã¯ããæå®ãã¾ããæå®ã§ããã®ã¯ãGMapã¨GMarkerã®ãªãã¸ã§ã¯ãã«ãªãã¾ãã
eventNameã«ã¯ãªãã¹ã³ããã¤ãã³ãã®ç¨®é¡ãæååã§æå®ãã¾ããAPIããã¥ã¡ã³ãã§ã¯ããã¦ã¹ã¤ãã³ãé¢é£ã¯clickããæ¸ããã¦ããªãã®ã§ãããå®éã«ã¯'mousedown'ã'mouseup'ã'mouseover' ãªã©ãé常ã®HMTLã®ãã¦ã¹ã¤ãã³ããåããããã§ã*1 *2ã
functionã«å¼ã³åºãé¢æ°ãæå®ãã¾ãã
addListenerã¨bindã®éãã¯ãbindã®å ´åãobjectã®å¼æ°ã§æ¸¡ãããªãã¸ã§ã¯ããfunctionã®å®è¡ä¸»ä½ã«ãªãã¾ããã¤ã¾ããå¼æ°ã§æ¸¡ããobjectãfunctionå
ã§thisã«ãªãã¾ãã
ããã使ã£ã¦ã¯ã¦ãªããããããã£ã¦ã¿ã¾ããã
以ä¸ã®ããã¯ãã¼ã¯ã¬ãããå®è¡ããã¨ãã¯ã¦ãªãããä¸ã§fotoã®ãã¼ã«ã¼ã«ãã¦ã¹ãªã¼ãã¼ããã ãã§åçã®å¹ãåºãã表示ããããã«ãªãã¾ãã
javascript:void((function(){for(var i=0;i<page.fotos.points.length;i++){var hmarker = page.fotos.points[i];var gmarker = hmarker.marker;GEvent.bind(gmarker,'mouseover',hmarker, function(){this.openInfoWindow();});}})())
IE6.0(on XP)ã¨Firefox1.0ã§ç¢ºèªããºã¼ã ã¬ãã«ãå¤ãããããã¨ããã¼ã«ã¼ãæ´æ°ããã¦è¿½å ããã¤ãã³ããã³ãã©ãæ¶ãã¦ãã¾ãã§æ³¨æã
ããã使ãã°ã10/27ã®ã¯ã¦ãªã¢ã¤ãã¢ãã¼ãã£ã³ã°ã§ãããã¦ã¹ãªã¼ãã¼ãåãããããããªããããã³ã¼ãéã£ã¦ï¼ãã§æ¤è¨ä¸ã«ãªã£ã¦ãããã¯ã¦ãªã¢ã¤ã㢠ããå®è£ ã§ããããããªãããªã¨æãã¾ãã
ã¡ãªã¿ã«ãä¸è¨ããã¯ãã¼ã¯ã¬ããã§ã¯ããã¦ã¹ã¢ã¦ãã§å¹ãåºããéããå¦çããã£ã¦ãªãã§ããå¹ãåºããéããã¿ã¤ãã³ã°ã§ããããã¹ã¯ãã¼ã«ãã¦ããã¦ã¹ãªã¼ãã¼ãã¦ãã¾ããã¨ãããã®ã§ãå®éã«idea:4072ãå®è£ ãããªããå¹ãåºãã¯ä½¿ããã«èªåã®Divã§ãã¼ã«ãããã¿ããã«è¡¨ç¤ºããã»ããããããã§ãã