1

In my page, I have some markers and I want to show a title on each marker on hover. This was simple in Google Maps as we were using title parameter for google.maps.Marker() object. I couldn't find anything like in Here Maps and I decided to make a simple, similar one.

Now I have a nokia.maps.map.Container() which has one infobuble, one marker and two events: mouseenter and mouseleave. I can open infobubble in mouseenter event, but I can't close it in mouseleave event. I'm trying to use closeBubble(), but I'm unsuccessful.

Here is the fiddle of my work so far: http://jsfiddle.net/ffAKX/

How can I close that opened infobubble when mouse leaves marker object? Or is there any simple way to do this like title parameter of google.maps.Marker() object?

alpakyol
  • 2,402
  • 2
  • 29
  • 35

1 Answers1

3

The documentation on the InfoBubbles component can be found here. If you look at the closeBubble() method, you can see that it takes a bubble handle as a parameter. This needs to be remembered from the previous openBubble()

var infoBubbles = new nokia.maps.map.component.InfoBubbles(),
    bubble;

map.components.add(infoBubbles);
container = new nokia.maps.map.Container();

container.addListener("mouseenter" ,  function(evt) {
    bubble =infoBubbles.openBubble(evt.target.html, evt.target.coordinate);   
}, false);

container.addListener("mouseleave" ,  function(evt) {
    infoBubbles.closeBubble(bubble); // I need to close infoBubble here
});

The result is very much like a tooltip, an actual tooltip component can be found on the HERE Maps community pages

Jason Fox
  • 5,115
  • 1
  • 15
  • 34
  • This works great, thank you. Looks like the tooltip component is the better idea. – alpakyol Mar 25 '14 at 08:05
  • I guess this depends on the version being used. This worked for me: http://stackoverflow.com/questions/33731921/how-to-remove-previous-infobubble-if-i-click-different-marker-in-here-map – gdvalderrama Jul 13 '16 at 11:42
  • @Jason Fox, Hi, Is there any effect on app performance if we use MapOverlay class instead InfoBubble? Because I want to show multiple info bubbles at a time on each `MapMarker`, but it is not possible at this moment as per [doc](https://developer.here.com/mobile-sdks/documentation/android-premium/topics_api_nlp_hybrid_plus/com-here-android-mpa-mapping-mapmarker.html#topic-apiref__showinfobubble-void). So I'm planning to use `MapOverlay`. – Onkar Nene Jul 18 '17 at 06:55
  • @roy-milller - The [HERE Android SDK](https://developer.here.com/mobile-sdks/documentation/android-premium/topics/overview.html) and the [HERE JavaScript API](https://developer.here.com/develop/javascript-api) are two separate products. The `InfoBubble` discussion above relates to the JavaScript API. – Jason Fox Jul 18 '17 at 11:35