Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google maps setting width and height #10

Open
4evermaat opened this issue Mar 25, 2016 · 1 comment
Open

google maps setting width and height #10

4evermaat opened this issue Mar 25, 2016 · 1 comment

Comments

@4evermaat
Copy link

Is there a way to pass width and height parameters (attributes) for google maps? Preferably by %, but fixed pixels is ok also.

@4evermaat
Copy link
Author

I inspected the page using Google Chrome inspection tool. In the map area, I found these divs in the body:

<div id="map" class="googlemap" style="position: relative; overflow: hidden; transform: translateZ(0px); background-color: rgb(229, 227, 223);">

<div class="gm-style" style="position: absolute; left: 0px; top: 0px; overflow: hidden; width: 100%; height: 100%; z-index: 0;">

So I figured it out.

You have to wrap the gravstrap g-map shortcode in a div style that defines the height and width. You can do this directly in markdown files. Example:

`


[g-map] [/g-map]

`

A full example is:

<div class="gm-style" style="position: static; width: 100%; height: 100%; z-index: 0; "> 
[g-map id=map zoom=12 center="41.90278,12.49637"]
[g-map-marker location="41.90278, 12.49637" title="Gravstrap theme"]
**Meet Us**
We are there!
[/g-map-marker]
[/g-map]
</div>

You can use fixed pixels also like width: 300px;, but width: 70%; seems more appropriate for websites that are dynamic for mobile devices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant