Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:07:10+00:00 2026-06-09T06:07:10+00:00

I’m trying to display a Google Map on a JQuery Mobile page, but am

  • 0

I’m trying to display a Google Map on a JQuery Mobile page, but am having difficulty getting it to display correctly every time the page is loaded.

I have two of the main pages working:

  1. index.php
  2. map.php

When loading the site from index.php then switching to map.php in the navbar, the map loads the first time. Switching back to index.php and then back to map.php again, the map’s center loads in the top left and the full map is not displayed until the screen is touched (none of this occurs on a computer’s browser, however). However, if I load map.php first, the map stays in place with any page changes back and forth.

My test site is http://beersandears.net/mbeta/

Any ideas on what I am missing? I’ve gotten to this point from research on the Internet, but nothing I have tried is helping to resolve this issue, including:

  • jQuery Mobile & Google Maps Glitch
  • Google Map API v3 off center if reloaded (not the usual ‘resize’ thing)
  • Why is the centering of my map off in my jQuery Mobile / Google Maps API3 application?

The third one seems very similar to my issue but the solution of using “pageshow” isn’t working.

Here is the code for map.php:

<!DOCTYPE html>
<html>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title('|', true, 'right'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://maps.google.com/maps/api/js?key=AIzaSyBtVQWtkD4MjJ3zbe9DXgPqSlC2XDn5K7c&sensor=true" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<style type="text/css">
img {
    max-width:100%;
    height:auto;
}
</style>
</head>
<body>
<div id="wrapper" data-role="page" id="map_page">
    <div id="header" data-role="header" data-position="fixed" data-id="head">
        <h1>WDW Map</h1>
    </div><!-- end header -->
    <div id="map_canvas" data-role="content">
    </div><!-- end content -->

<div id="footer" data-id="navbar" data-role="footer" data-position="fixed"> 
    <div id="navbar" data-role="navbar">
        <ul>
            <li><a href="index.php">WDW Beer List</a></li>
            <li><a href="map.php">WDW Map</a></li>
            <li><a href="blog.php">Articles</a></li>
        </ul>
    </div><!-- end navbar -->
</div><!-- end footer -->
<script type="text/javascript">
        $(function(){
            initializeMap(28.385208623548024,-81.56713485717773);
        });

        function initializeMap(lat,lng) {
            var adjustedHeight = ($(window).height());
            $('#map_canvas').css({height:adjustedHeight});
            //$("#map_canvas").height = $(window).height() - $("#header").height() - $("#footer").height();
            setTimeout(function() {

                var latlng = new google.maps.LatLng(lat, lng);
                var myOptions = {
                        zoom: 12,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };

                var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
                //var crosshairLayer = new google.maps.KmlLayer('http://freezoo.alwaysdata.net/justcrosshair2.kml',
                //{preserveViewport: true});

                //crosshairLayer.setMap(map);

                google.maps.event.trigger(map, 'resize');
                map.setZoom( map.getZoom() );
            }, 500);
        }
</script>
</div><!-- end wrapper -->
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:07:12+00:00Added an answer on June 9, 2026 at 6:07 am

    Solved. I had two IDs in the data-role="page" div and it was reading the first one as the ID while I was trying to reference the second one. The pageshow event fix now works as seen in the third link above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.