Richardlonesteen
Richardlonesteen

Reputation: 594

map lace map doesn't show up

Sorry this might seem like a stupid question, but has been frustrating me for a second day now ;///

I can get the map to show up no matter what.

Created new test project this is Application.html.erb

<!DOCTYPE html>
<html>
<head>
      <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #gmap { height: 100% }
    </style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7">
</script>
    <script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
      <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "maplace.min" %>
<script type="text/javascript">
$(function() {
    new Maplace({
        locations: [-34.397, 150.644],
        controls_on_map: false
    }).Load();
});
</script>
  <title>Maptest</title>
</head>
<body>
<div id="gmap"></div>
</body>
</html>

and it seems that all of the javascripts are loaded without any erros

And it seems like all of the javascripts are loaded without any problems. Please Help

Upvotes: 1

Views: 881

Answers (2)

Daniel Romero
Daniel Romero

Reputation: 1588

I think this should work, try:

new Maplace({
    locations: [{
        lat: -34.397, 
        lon: 150.644
    }],
    controls_on_map: false
}).Load();

Upvotes: 1

K K
K K

Reputation: 18099

I think you need to give proper dimensions to the map container. As seen from the post, you mentioned:

#gmap { height: 100% }

But, I guess it's missing the width. You should try adding the width to the container. Something like:

#gmap { height: 100%;width:400px;} //Just a random dimension.

Upvotes: 1

Related Questions