www.webdeveloper.com
Results 1 to 4 of 4

Thread: Avoiding JavaScript redundancy. Google Maps.

  1. #1
    Join Date
    Jul 2012
    Posts
    19

    Avoiding JavaScript redundancy. Google Maps.

    So I have going to have a table containing multiple google maps, targeting various long-latitude coordinates. I have the basic JavaScript <script> written to place the map there, but I was curious if there was a quicker way to add all the maps. Perhaps pass the coordinates from the <td> somehow? Without having to write the JS for each map...

    Any suggestions?

    Thank you in advanced!!!

  2. #2
    Join Date
    Dec 2002
    Location
    Seattle, WA
    Posts
    1,843
    i would suggest using only one map. having multiple maps going would eat up a lot of resources on the client-side. you could then have buttons that add the coordinates to the map and pans to them.
    Code:
    function panToNewCoord(x, y)
    {
        // remove any previous coords set (if needed)...
        // add marker...
        // pan to coords...
    }

  3. #3
    Join Date
    Mar 2012
    Posts
    1,816
    I agree with the above comment. Running multiple Google maps does not work. However, you can have multiple maps visible, so long as only one is active at a time. What you do is:

    - Capture and optimize a screen shot of each map.
    - Decide which one (if any) will be the default map. Note: Your initial page load is faster if none are active by default!
    - Display the default map (if any) and use the static images of the others as graphical anchors to animate the respective map.

    You can achieve the swapping of the active map by using separate web pages, one for each active map, or by using JavaScript. I'm old fashioned and use the separate web page approach.
    Last edited by jedaisoul; 04-30-2014 at 03:40 AM.

  4. #4
    Join Date
    Jul 2012
    Posts
    19
    Ok. I appreciate it! I think the screenshot of the map as an image, and being clickable, targeting the actual map, would worked best.

    Thanks again!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles