Google Maps: infobox turns up behind markers?

Kaare

For some reason my infoBox'es turn up behind the markers. I know this is supposed to be impossible, but it is never the less the case. Here is the code for my markers:

        var yellowCircle={
          path: google.maps.SymbolPath.CIRCLE,
          scale: 5,
          fillColor: '#faeadd',
          strokeColor: 'black',
          fillOpacity: 1.0,
          strokeWeight: 0.5,
          zIndex:-10
        };

        var yellowBlackCircle={
          path: google.maps.SymbolPath.CIRCLE,
          scale: 5,
          fillColor: '#faeadd',
          strokeColor: 'black',
          fillOpacity: 1.0,
          strokeWeight: 1.5,
          zIndex:-10

        };


            var marker = new google.maps.Marker({       
                position: new google.maps.LatLng(Lat,Lng), 
                map: map,  
                title: name,
                icon:yellowCircle,
                url:url,
                zIndex:-1,
            });

             google.maps.event.addListener(marker, 'mouseover', function() {
            marker.setIcon(yellowBlackCircle);
              });

            google.maps.event.addListener(marker, 'mouseout', function() {
                marker.setIcon(yellowCircle);
                });

             google.maps.event.addListener(marker, 'click', function() {
              window.location.href = url;
             });

And the code for my infoboxes:

    var myOptions = {
                content: name
                ,boxStyle: {
                  border: "1px solid black"
                 ,textAlign: "center"
                 ,fontSize: "12pt"
                 ,fontType: "arial"
                 ,backgroundColor: "#faeadd"
                 ,fontWeight: "bold"
                 ,zIndex:1
                }
               ,disableAutoPan: true
               ,pixelOffset: new google.maps.Size(-getTextWidth(name, "bold 12pt arial")/2,-30)
               ,position: new google.maps.LatLng(49.47216, -123.76307)
               ,closeBoxURL: ""
               ,isHidden: false
               ,pane: "mapPane"
               ,enableEventPropagation: true
               ,zIndex:1
            };

            var infobox = new InfoBox(myOptions);

             google.maps.event.addListener(marker, 'mouseover', function() {
                infobox.open(map,marker);
              });

              google.maps.event.addListener(marker, 'mouseout', function() {
                infobox.close();
              });

You can see that I have even tried setting the zIndex'es as well, but it has no effect. I believe this is the same question as was asked in google maps infobox above all other content z-index does not work.

I apologize for not attaching a jsfiddle - I couldn't seem to make it work, even after I uploaded the infobox_packed.js to a repository so I could add is as external resource. Instead, here is the whole thing: http://www.kaarebmikkelsen.dk/wp-content/uploads/2014/05/test2.html

The info-box code is mostly copied from https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html.

geocodezip

Your code came from the example that makes "map labels" and you are attaching the infoBox to the mapPane:

pane: "mapPane"

That will put it behind the markers. If you want it to be an infowindow replacement, copy the code from that example:

pane: "floatPane"

from the documentation you reference

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

ReactJS and Google Maps - Displaying Markers

分類Dev

Bing Maps Polygon InfoBox

分類Dev

Placing Circles instead of Markers in google maps

分類Dev

Google maps delete all markers and then create new

分類Dev

Google Maps fit markers in custom bounds

分類Dev

Google maps API markers content hide by default

分類Dev

How to hide/show groups of markers by category with Google Maps in Android?

分類Dev

Google Maps API 3 - Show All Markers on Screen, but Keep Centerpoint

分類Dev

How to get all markers in google-maps-react

分類Dev

How to Add Google Maps with Multiple Markers Showing Infowindows on Load and on Click

分類Dev

How to delete markers from my own google maps

分類Dev

Setting listeners to groups of markers using Google Maps API

分類Dev

Google Map API V3 - infowindows @ markers on 2 maps

分類Dev

Google maps clear all markers before placing new one

分類Dev

Typescript + Google Maps API + infobox.js Uncaught TypeError:InfoBoxはコンストラクターではありません

分類Dev

Typescript + Google Maps API + infobox.js Uncaught TypeError:InfoBoxはコンストラクターではありません

分類Dev

Google Maps Infoboxの画像は、画像ギャラリーのある別のInfoboxに表示されます

分類Dev

Google Maps API 3 Load Markers from MySQL from current position

分類Dev

Get Markers Addresses in Input fields using Drag-able Google Maps API V3

分類Dev

Map markers not rendering - Google Maps Javascript API v3 In Phonegap

分類Dev

Adding Multiple Markers in real time google maps v2 android

分類Dev

How to manage Markers well using google maps api v2 on android

分類Dev

Slick.js는 Google Maps API의 infoBox.js에서 작동하지 않습니다.

分類Dev

How to apply CSS to Here Maps API Markers

分類Dev

Draw circles around multiple markers in Maps

分類Dev

Googleマップ:InfoWindow vs InfoBox vs InfoBubble

分類Dev

Googleマップ:InfoWindow vs InfoBox vs InfoBubble

分類Dev

AngularJS Google Map with Multiple Markers

分類Dev

TypeError:google.maps.Markersはコンストラクターではありません

Related 関連記事

  1. 1

    ReactJS and Google Maps - Displaying Markers

  2. 2

    Bing Maps Polygon InfoBox

  3. 3

    Placing Circles instead of Markers in google maps

  4. 4

    Google maps delete all markers and then create new

  5. 5

    Google Maps fit markers in custom bounds

  6. 6

    Google maps API markers content hide by default

  7. 7

    How to hide/show groups of markers by category with Google Maps in Android?

  8. 8

    Google Maps API 3 - Show All Markers on Screen, but Keep Centerpoint

  9. 9

    How to get all markers in google-maps-react

  10. 10

    How to Add Google Maps with Multiple Markers Showing Infowindows on Load and on Click

  11. 11

    How to delete markers from my own google maps

  12. 12

    Setting listeners to groups of markers using Google Maps API

  13. 13

    Google Map API V3 - infowindows @ markers on 2 maps

  14. 14

    Google maps clear all markers before placing new one

  15. 15

    Typescript + Google Maps API + infobox.js Uncaught TypeError:InfoBoxはコンストラクターではありません

  16. 16

    Typescript + Google Maps API + infobox.js Uncaught TypeError:InfoBoxはコンストラクターではありません

  17. 17

    Google Maps Infoboxの画像は、画像ギャラリーのある別のInfoboxに表示されます

  18. 18

    Google Maps API 3 Load Markers from MySQL from current position

  19. 19

    Get Markers Addresses in Input fields using Drag-able Google Maps API V3

  20. 20

    Map markers not rendering - Google Maps Javascript API v3 In Phonegap

  21. 21

    Adding Multiple Markers in real time google maps v2 android

  22. 22

    How to manage Markers well using google maps api v2 on android

  23. 23

    Slick.js는 Google Maps API의 infoBox.js에서 작동하지 않습니다.

  24. 24

    How to apply CSS to Here Maps API Markers

  25. 25

    Draw circles around multiple markers in Maps

  26. 26

    Googleマップ:InfoWindow vs InfoBox vs InfoBubble

  27. 27

    Googleマップ:InfoWindow vs InfoBox vs InfoBubble

  28. 28

    AngularJS Google Map with Multiple Markers

  29. 29

    TypeError:google.maps.Markersはコンストラクターではありません

ホットタグ

アーカイブ