joelrnorris
joelrnorris

Reputation: 185

Google Maps API v3 controls showing up behind map

greetings & salutations,

this is my first run with the google maps API, i'm using WordPress and the Genesis Framework,

i'm working through a tutorial on http://tympanus.net/codrops/2011/04/13/interactive-google-map/

and i've gotten a google map to show up on the map page,

http://www.foodtrucksnashville.com/map/

however, you'll notice the map controls are underneath the map. hmmm.

no idea. need help / nudge in teh right direction.

thx again, stackoverflow community.

here's the code in the init.js:

var map, geocoder, marker, ey, my, mouseDown = false;

var o = {
    init: function () {
        this.map.init();
    },
    map: {
        size: function () {
            // so it's a loverly sqware.
            var w = jQuery('.content-sidebar #content').width(),
                h = 440;
            return {
                width: w,
                height: h
            }
        },
        data: {
            zoom: 13,
            center: new google.maps.LatLng(36.165389, -86.783237), // Nashville TN Capitol BLDG
            scrollwheel: false,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        },
        init: function () {
            // get the map size
            var size = o.map.size();
            // add some css to the #map div based on the size
            jQuery('#map').css({
                width: size.width,
                height: size.height,
            });

            // make a new google map in the #map div and pass it the map data
            map = new google.maps.Map(document.getElementById('map'), o.map.data), geocoder = new google.maps.Geocoder();
            /*
            // add eventlistener to map to hide posts when dragging?
            google.maps.event.addListener(map, 'dragstart', function () {
                jQuery('.posts').hide();
            });
            */
        }
    } // end map
} // end o object

jQuery(window).load(function () {
    o.init();
});

Upvotes: 0

Views: 1046

Answers (2)

dragoweb
dragoweb

Reputation: 731

My problem came from a z-index on my css file. Tried to disable one by one until I found it.

figure.rounded img {
width: 100%;
z-index: -1;  /*  Here he is  */
position: relative;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}

Upvotes: 1

joelrnorris
joelrnorris

Reputation: 185

finally figured out what as going on, found the solution over at google groups for the Maps API v3,

http://code.google.com/apis/maps/documentation/javascript/forum.html?place=topic%2Fgoogle-maps-js-api-v3%2F8dOLhjNQzmo%2Fdiscussion

there were some css properties buried in my child theme targeting images with some max-width: 100%.

once i removed all the references targeting img elements with max-width, life was groovy again.

Upvotes: 0

Related Questions