Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Making a resizable map
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Endico  
View profile  
(1 user)  More options Jul 7 2005, 1:14 am
From: "Endico" <end...@gmail.com>
Date: Thu, 07 Jul 2005 05:14:31 -0000
Local: Thurs, Jul 7 2005 1:14 am
Subject: Making a resizable map
First I'll explain how I was able to make a resizable map, then I'll
explain some bugs i ran across and how to work around them. Here's my
example:
http://www.speakeasy.org/~endico/maps/simple-resizable.html

To make a map resizable you need to specify the height and width for
all its containers in terms of percent. In my example I need to add
height and width attributes to <html>, <body> and the <div> containing
the map.

<style type="text/css">    v\:* {
      behavior:url(#default#VML);
    }
    html, body {
      height: 96%;      width: 96%
    }
</style>

and

<div id="map" style="width: 98%; height: 90%"></div>

Bugs:
1.  adding height and width attributes to the original google example
script (http://www.google.com/apis/maps/documentation/simple.html) gave
the following javascript error which i was able to work around by
moving the script from the <head> to the <body>;.

  Error: uncaught exception: assertion failed: Error()@:0
  fb(null)@http://maps.google.com/mapfiles/maps.10.js:57
  l(null)@http://maps.google.com/mapfiles/maps.10.js:158
  @http://www.speakeasy.org/~endico/maps/simple-max.html:19

2. If you prefer to keep your css in a separate file, you'll still need
to keep the definition for height in the html file as I did in this
example:
http://www.speakeasy.org/~endico/maps/simple-resize-css.html

I had a couple different things happen to me when i tried to move
'height' to the external css file. In the simple-resize-css example,
using mozilla, the map did not display.

Moving 'height' worked fine with my usgs map when i used mozilla, but
safari got confused and placed the equator up at the top of the map box
where the north pole should have been.
http://www.speakeasy.org/~endico/maps/usgs.html

3. I don't have much data on MSIE, but I read in another thread that
MSIE gets confused if you set height and width to 100%. I think 98%
should work.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Kagerer  
View profile  
 More options Jul 7 2005, 7:21 am
From: "Richard Kagerer" <r...@leapbeyond.com>
Date: Thu, 07 Jul 2005 04:21:51 -0700
Local: Thurs, Jul 7 2005 7:21 am
Subject: Re: Making a resizable map
Great work!  I've evolved your solution a little based on my own
testing.  Note the following additional requirements:

- You must listen to the window.onResize event and call the
map.onResize() function when the window is resized.  Otherwise the
Google map doesn't seem to know that the window's been resized, and two
problems will occur:

1) The map won't recenter properly when double-clicking
2) If you start out with a small window size, and then make it a LOT
bigger, the map won't take up the full screen.  That's cause you're not
actually making the map bigger, you're just seeing the "offscreen" area
of it.

if (window.attachEvent) {
    window.attachEvent("onresize", function() {this.map.onResize()} );

} else {

    window.addEventListener("resize", function() {this.map.onResize()}
, false);

}

- 100% height works for me if I specify 0 for all body margins:

body {margin-top: 0px; margin-right: 0px; margin-left: 0px;
margin-bottom: 0px}

To view the full demo, go to:
http://www.leapbeyond.com/ric/scuba/appletdemo/FullScreenMap.htm


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Billy  
View profile  
 More options Jul 7 2005, 8:18 pm
From: Billy <billy.girla...@gmail.com>
Date: Thu, 7 Jul 2005 20:18:34 -0400
Local: Thurs, Jul 7 2005 8:18 pm
Subject: Re: Making a resizable map
sweet ya'll, if you don't mind... lol

On 7/7/05, Richard Kagerer <r...@leapbeyond.com> wrote:

--
BeachComputers.biz

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Beach Comber  
View profile  
 More options Jul 8 2005, 12:37 pm
From: "Beach Comber" <BeachN...@worldbeachlist.com>
Date: Fri, 08 Jul 2005 09:37:56 -0700
Local: Fri, Jul 8 2005 12:37 pm
Subject: Re: Making a resizable map
Very nice seeing the resize on a full screen map.  Have you seen an
easy way to make resiziable maps which still allow for top and side
static content areas?  This would work much like the maps.google.com
site itself with a static sized area on the top and right sides of the
window.  My experiments so far with a div block inside of a table cell
(which does resize correctly) have gone very badly.

Thanks.

Beach Comber
http://worldbeachlist.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Kagerer  
View profile  
 More options Jul 8 2005, 4:11 pm
From: "Richard Kagerer" <r...@leapbeyond.com>
Date: Fri, 08 Jul 2005 13:11:57 -0700
Local: Fri, Jul 8 2005 4:11 pm
Subject: Re: Making a resizable map
Beach Comber,

If all browsers obeyed CSS, it would be easy.  The following works
perfectly in Firefox:

<div id="map" style="position:absolute; left:0px; top:0px; bottom:0px;
right:300px;"></div>
<div id="rightpanel" style="position:absolute; right:0px; top:0px;
bottom:0px; width:300px;">Right panel</div>

But it doesn't work in MSIE.  The problem is that in MSIE, the DIV's
are shrunk to fit their content.  Since there's no content in the map
div, it is shrunk infinitesimally.  You can set the div's width and
height to 100%, but then it underlaps the right panel, and the map
doesn't center properly.  I tried playing with things like
margin-right:300px, but that didn't help either.

If you're not anal about keeping your right panel a constant-width, you
could do something like the following:

<div id="map" style="position:absolute; height:100%; width:80%;"></div>
<div id="rightpanel" style="position:absolute; left:80%;
width:300px;">Right panel</div>

But if you want to emulate the layout at maps.google.com, The only
surefire way I know if is to avoid using percentage height/width's
altogether, and adjust things using javascript on the window.resize
event.

That's what I do on
http://www.leapbeyond.com/ric/scuba/googlemap/googlemap.htm (which is
still pre-API, btw, but the technique should be similar).

Maybe someone with more CSS experience has a more elegant solution that
doesn't need javascript?

Cheers,

-Richard


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Kagerer  
View profile  
 More options Jul 9 2005, 9:27 am
From: "Richard Kagerer" <r...@leapbeyond.com>
Date: Sat, 09 Jul 2005 06:27:12 -0700
Local: Sat, Jul 9 2005 9:27 am
Subject: Re: Making a resizable map
I stand slightly corrected.  margin-right does work, if you remove
position:absolute for the map div first.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google