Responsiveness CGGooglemaps 2.4.7

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
janvl
Power Poster
Power Poster
Posts: 985
Joined: Wed Aug 13, 2008 10:57 am

Responsiveness CGGooglemaps 2.4.7

Post by janvl »

Is it possible to bring responsiveness to CGGooglemaps.
I have changed the standard template to:

<div id="cggm_map_display_{$mapinstance}" style="width: 94%; height: 500px;">{* the map will go here *}</div>

But although it is saved and shows in the sourcecode on the site, I still get a width that is a fixed amount of 800 pixel.

For now I have put the width to 400 px.

Kind regards,
Jan
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Responsiveness CGGooglemaps 2.4.7

Post by JohnnyB »

Why not add a class or ID to it instead of inline CSS?

Add a class and then set the width:100% and max-width:100% and height:auto

Then, in a responsive situation, the container will expand no more than 100% of the container that it is inside of and shrink to fit the container as the viewport decreases in size.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
janvl
Power Poster
Power Poster
Posts: 985
Joined: Wed Aug 13, 2008 10:57 am

Re: Responsiveness CGGooglemaps 2.4.7

Post by janvl »

Thank you JohnnyB

but this is the template that is part of CGGooglemaps.
So I first tried to change it with the inline CSS.

That however does not do what inline-css is supposed to do.
The latest values for width and height are stored somewhere, even if you leave them blank and save, refreshing the page gives you the last pixel values for width and height. Mediaqueries have no effect.

That is why I would like to know if it is possible to use the module with a responsive design, and how.
In the meantime I tried module "Googlemaps" that has the same problem, not accepting percentages but only pixel values.

Kind regards,
Jan
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Responsiveness CGGooglemaps 2.4.7

Post by JohnnyB »

Perhaps you are not modifying the correct template. Be sure you are editing the template for the map you are trying to load and not the default template.

Responsiveness is all Frontend. So, that is the way to make it responsive. Using frontend code (CSS or JS) to make it work for you. The module itself (backend programming) cannot be made to be responsive.

Again, I would set a class name a and the rules I suggested. If it is not helping, there is a CSS conflict that is overriding your new rules. Use the browser's Inspector (Inspect Element) and see what is going on.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Responsiveness CGGooglemaps 2.4.7

Post by Dr.CSS »

How are you testing the responsiveness of it, making the browser narrow, looking at it with a phone/tablet/etc..?

Something need to be refreshed when changing browser size...
janvl
Power Poster
Power Poster
Posts: 985
Joined: Wed Aug 13, 2008 10:57 am

Re: Responsiveness CGGooglemaps 2.4.7

Post by janvl »

I made a second map and use display none to show the right one.

Kind regards,
Jan
wmdvanzyl
Forum Members
Forum Members
Posts: 214
Joined: Fri May 06, 2011 12:48 pm

Re: Responsiveness CGGooglemaps 2.4.7

Post by wmdvanzyl »

What does that mean Jan? I want to know if this is an issue or if it is resolved?
janvl
Power Poster
Power Poster
Posts: 985
Joined: Wed Aug 13, 2008 10:57 am

Re: Responsiveness CGGooglemaps 2.4.7

Post by janvl »

Ok

it is not a nice solution but it works.

I made 2 maps 1 with 750 x 500 px, the other with 300 x 500 px
in both the same 3 markers.

In the page i have 2 divs, one containing the wide map and one containing the small map, in the media queries I use

display:none; for the small map if I have a wider screen
display:block; for the wide map if I have a wider screen

display:block; for the small map if I have a small screen
display:none; for the wide map if I have a small screen

Kind regards,
Jan
Post Reply

Return to “Modules/Add-Ons”