removing default mouseover tooltip from marker in google-maps

后端 未结 3 1686
执念已碎
执念已碎 2021-01-14 01:28

I have created an application for showing an Information Window popup for markers, The application is working fine and the popup is showing correctly but the only solution i

相关标签:
3条回答
  • 2021-01-14 02:04

    You could manually remove the element title attribute on mouseover.

    Try changing

    google.maps.event.addListener(marker, 'mouseover', function () {
    

    To

    google.maps.event.addListener(marker, 'mouseover', function (e) {
        e.ya.target.removeAttribute('title');
    

    Also for Edge, you need to be change it to:

    e.ya.target.parentElement.removeAttribute('title')
    

    JSFiddle Link (Google Maps API not working)

    0 讨论(0)
  • 2021-01-14 02:18

    It appears that the title of your marker is set to the html content of your pop up window. When you create the marker object, give it a title attribute of what you would like to be displayed (i.e. name of your location...)

    var marker = new google.maps.Marker({
      position: whateverpositionyouset,
      title: whatevertitleyouwant,
      map: map
    })
    
    0 讨论(0)
  • 2021-01-14 02:22

    I have been taking advantage of this thread in working on almost the same problem. I am able to get the Google Maps API to properly display European accented glyphs in the pop-up display when a marker is clicked, but the same encoded text string is not properly rendered on mouseover.

    So, after looking at the helpful code example in JSFiddle, and not being able to use that suggested technique for removing the 'title' text, it finally became clear to me what MrUpsidown was suggesting when he thought we might just change the name of the property being displayed as a title. I did not realize that the definition of the reserved property 'title' was "text to be displayed on hover." So, the simplest solution is to use a property such as 'myTitle' in the Marker options list. When there is no title property, hovering becomes a non-event.

    0 讨论(0)
提交回复
热议问题