How to hook into the "close infobubble" event in HERE maps Javascript API -
i can create infobubbles using here maps javascript api - eg documentation:
function addinfobubble(map) { map.set('center', new nokia.maps.geo.coordinate(53.430, -2.961)); map.setzoomlevel(7); var infobubbles = new nokia.maps.map.component.infobubbles(), touch = nokia.maps.dom.page.browser.touch, click = touch ? 'tap' : 'click', container = new nokia.maps.map.container(); container.addlistener(click, function (evt) { infobubbles.openbubble(evt.target.html, evt.target.coordinate); }, false); map.components.add(infobubbles); map.objects.add(container); addmarkertocontainer(container, [53.439, -2.221], '<div><a href=\'http://www.mcfc.co.uk\' >manchester city</a>' + '</div><div >city of manchester stadium<br>capacity: 48,000</div>'); addmarkertocontainer(container, [53.430, -2.961], '<div ><a href=\'http://www.liverpoolfc.tv\' >liverpool</a>' + '</div><div >anfield<br>capacity: 45,362</div>'); } function addmarkertocontainer(container, coordinate, html) { var marker = new nokia.maps.map.standardmarker( coordinate, {html: html} ); container.objects.add(marker); }
i hook close event of infobubble. realise use jquery find span contains close button (examining markup, believe has class nm_bubble_control_close
) , when clicked. thought there built-in event use.
does know if there built-in event fires when infobubble closed? can't find in documentation.
afaik there no built-in event, there's no related property may observed.
possible workaround: override built-in close
-method custom function:
container.addlistener(click, function (evt) { var b = infobubbles.openbubble(evt.target.html, evt.target.coordinate), c = b.close; b.close = function(){ //do want alert('bubble closed'); //execute original close-method c.apply(b) } }, false);
Comments
Post a Comment