Please see http://drupal.org/node/1570522 where I reported this issue to the Zen theme.

But perhaps the issue is caused by the location map module.

#5 gives some extra info.

CommentFileSizeAuthor
#18 responsive_maps_with_googlemapapikey-1590140-18.patch4.74 KBAnonymous (not verified)
#17 responsive_maps_with_googlemapapikey-1590140-17.patch4.7 KBAnonymous (not verified)
#15 responsive_maps-1590140-15.patch2.69 KBAnonymous (not verified)
#14 responsive_maps-1590140-14.patch2.48 KBAnonymous (not verified)
#13 responsive_maps-1590140-13.patch2.45 KBAnonymous (not verified)
#2 set-max-width-to-none-1590140-2.patch481 bytesishadakota

Comments

rupertj’s picture

Status: Active » Needs work

Linked issue contains a fix for this - if anyone would like to knock up a patch that includes it, I'll accept it.

ishadakota’s picture

Status: Needs work » Needs review
StatusFileSize
new481 bytes

Patch sets max-width to none.

babbage’s picture

Category: bug » feature

I understand why this works, and it is great that such a simple addition will enable a responsive map sizing.

However, wouldn't we get the same effect if we just set min-width, and didn't set either max-width or width? This would be easier code to understand, so unless there is a CSS-support quirk to do with min-width that we need to avoid, min-width would be preferable. Also going to need to make this configurable as not everyone will want a map that scales to fill the available space...

I will work on this soon, but if someone wants to get in first with an updated patch, ideally that you've tested cross-browser, you'll get attribution!

In my opinion, this is a feature request, not a bug report.

babbage’s picture

Title: Gmap renders incorrect in Zen responsive lay-out » Support responsive lay-out in locationmap
Assigned: Unassigned » babbage
Status: Needs review » Active

Marking #1678910: Support for responsive layouts as a duplicate of this issue, and updating title here.

babbage’s picture

Implementing this myself as proposed didn't work. I then noticed that IshaDakota's patch (which I didn't use) has invalid syntax in the CSS anyway, suggesting there is no way that the code base that patch was based on was actually achieving the desired result. I'm going to assume that the patch was based on just implementing what was claimed to work, without testing it.

I'm pretty sure the issue here is that a Google Map simply doesn't resize just because its surrounding div is changing as the viewport size changes. That being the case, this may be a lot more complex to implement than had been suggested.

Edit: It occurs to me that the original issue and patch weren't trying to make the map responsive, per se, just to stop the map breaking in the responsive layout it was embedded in. I don't see those original problems when testing in the Omega theme, so therefore am not seeing the fix. But it might still be that this is fixing something. I'll try Zen responsive and see...

babbage’s picture

OK. Initial commit fixes the rendering issues with the map controls in the Zen responsive layout. In fact, you can't add the max-width: none CSS property into the module code as it needs to be applied to the image supplied by Google, so instead I've added a CSS file that only loads on the map page, and which applies the necessary fix to the image. Further testing welcome but this should not break anything so after my own testing I've committed it to the 7.x-2.x-dev branch.

Note that with this fix the map itself is still a static size but just renders correctly, including the map controls, when inside the Zen responsive layout. I am still interested to add an option for the map to be fully responsive within a responsive layout, but this will depend on what Google provides at their end I suspect. And now that I actually understand the original problem the OP was discussing properly, I agree this was a bug report not a feature request! But we've moved it on to a feature request with the wider vision of making it fully responsive, so I'll keep that status now. :)

quantos’s picture

Following. Same issue/result needed but for the Omega responsive theme system. I would have implemented via css but the google image type doesn't seem to respond to height: auto which I would have used in conjunction with width: 100%.

Q

Countzero’s picture

Subscribing to this, but I'd need responsive size for the Corolla theme (mean : Adaptive Theme subthemes).

This module is excellent BTW : perfect for simple websites without needs for complex mapping systems. Definitely fills a gap. Thanks.

stefan.korn’s picture

I am also interested to have the locationmap in a responsive way. I think it would be a good option to have width and height to be set on a percentage base as well (as proposed here: https://drupal.org/node/2094063). This way the map will be responsive. Although if you resize the window without reload the map gets only cropped, this is not nice. But if you load the map on different devices with different screen size the map will fit responsive. So I think this is far better then fixed px width for responsive layouts.

Exploratus’s picture

+1

pavloukos’s picture

Issue summary: View changes

I've actually managed to make the map responsive as follows:

locationmap.css:

#locationmap_map {
}

-----

locationmap.module - I set the width to a percentage and the height to a fixed value.

function theme_locationmap_map($variables) {
  
   ...
 
  return ('<div id="locationmap_map" style="width: 90%; height: 500px"></div>');
}

---

locationmap.js - before the last if statement add the following event
This will center the marker on window resize

      google.maps.event.addDomListener(window, 'resize', function(){
        map.panTo(mapOptions.center);
      });
babbage’s picture

#locationmap_map {
}

Adding this to the CSS file does nothing, unless you are implying by this that existing content in the CSS file should be removed?

Submitting an actual patch against the module will make for a much clearer target to test against. See https://drupal.org/patch/submit

Anonymous’s picture

Title: Support responsive lay-out in locationmap » Makes maps responsive
Version: 7.x-2.1 » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new2.45 KB

Here's a patch that makes maps responsive. It does two things:

  1. Adds max-width: 100%; to the map's container div - this means people can still set a static width, but the map will never overflow the container it's in (e.g. on a large screen the 500px map will be 500px wide, but on a small phone screen it will be 100% of its container).
  2. Moves the CSS and JS to the map theme function so that all maps are affected by the CSS fix - previously the page map was fixed but not the interactive block map. Also reduces duplication by moving both bits of code to the one function.

Maps will only ever be the height as set; I'm not sure how to make that change so as to keep the width/height ratio...

Anonymous’s picture

StatusFileSize
new2.48 KB

Here's an updated patch that adds '!important' to the max-width: none CSS (I found a theme that was overriding this due to more-specific CSS selectors).

Anonymous’s picture

StatusFileSize
new2.69 KB

Updated for latest dev.

jprstoney’s picture

#11 worked for me.

Anonymous’s picture

Here a patch that doesn't necessarily replace the patch from #15 but rather is an update of that one to allow for the changes in the patch from https://www.drupal.org/node/2760317 (i.e. Google Map API Key). Basically if you're using the API key patch, then apply that first, then apply this patch.

Anonymous’s picture

StatusFileSize
new4.74 KB

This patch replaces the one from #17 and is to be used in conjunction with the patch from https://www.drupal.org/node/2760317.

astonvictor’s picture

Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks