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

  • Home
  • SEARCH
  • 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 7533405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:42:58+00:00 2026-05-30T05:42:58+00:00

All, I’ve got the following code to display my maps: <script type=text/javascript src=http://maps.google.com/maps/api/js?sensor=false></script> <script

  • 0

All,
I’ve got the following code to display my maps:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script  type="text/javascript">
function addLoadEvent(func) { 
var oldonload = window.onload; 
if (typeof window.onload != 'function'){ 
    window.onload = func
} else { 
    window.onload = function() {
        oldonload();
        func();
    }
}
}

var map,
    infowin=new google.maps.InfoWindow({content:'moin'});
function loadMap() 
{
  map = new google.maps.Map(
    document.getElementById('map_vendor'),
    {   
      zoom: 15,
      mapTypeId:google.maps.MapTypeId.ROADMAP,
      center:new google.maps.LatLng(<?php echo $lat; ?>, 
                                    <?php echo $long; ?>)
    });

  addPoints(myStores);
}

function addPoints( points )
{  
  //var bounds=new google.maps.LatLngBounds();
  for ( var p = 0; p < points.length; ++p )
  {
    var pointData = points[p];
    if ( pointData == null ) {map.fitBounds(bounds);return; }
    var point = new google.maps.LatLng( pointData.latitude, pointData.longitude );
    //bounds.union(new google.maps.LatLngBounds(point));
    createMarker( point,  pointData.html );
  }
  //map.fitBounds(bounds);

}

function createMarker(point,  popuphtml) 
{
  var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
  var marker = new google.maps.Marker(
    {
      position:point,
      map:map
    }
  );
  google.maps.event.addListener(marker, 'click', function() {
      infowin.setContent(popuphtml)
      infowin.open(map,marker);
    });

}

function Store( lat, long, text )
{
    this.latitude = lat;
    this.longitude = long;
    this.html = text;
}

var myStores = [<?php echo $jsData;?>, null];
addLoadEvent(loadMap);
</script>

The $jsData is set with the following code:

$lat = get_post_meta($post->ID,'latitude',TRUE);
$long = get_post_meta($post->ID,'longitude',TRUE);
$post_id = $post->ID;
$get_post_info = get_post($post_id); 
$name = $get_post_info->post_title;
$jsData = $jsData . "new Store( $lat, $long, '$name' ),\n";

The point gets displayed correctly however my map isn’t being centered correctly. My maps is always southeast from the location of the point and just a little but I’d like for it to be centered on the point. How can I go about doing this?

EDIT: Here is the CSS that you requested. It’s a theme so I’m sorry if it’s crazy:

#map_vendor{
padding:10px;
width:925px;
height:300px;
}
.styled-image, .the-post-image figure, .styled-slideshow, .gallery .gallery-icon a { 
border-color: #C9CBCD;
background: #F7F7F7;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#E7E8EB));
background: -moz-linear-gradient(top, #fff,  #E7E8EB);
background: linear-gradient(#fff, #E7E8EB);
-pie-background: linear-gradient(#fff, #E7E8EB);  
}
.styled-image, .the-post-image a figure, .gallery .gallery-icon a { 
-webkit-transition: all 0.15s ease-in-out; 
-moz-transition: all 0.15s ease-in-out; 
transition: all 0.15s ease-in-out; 
}
.styled-image, .the-post-image figure, .styled-slideshow, .gallery .gallery-icon a { 
display: block; display: inline-block; outline: none; padding: 6px;
border: 2px solid #C9CBCD; border-width: 1px 1px 2px;
-webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; /* border radius */
/* gradient background */
background: #F7F7F7;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#E7E8EB));
background: -moz-linear-gradient(top, #fff,  #E7E8EB);
background: linear-gradient(#fff, #E7E8EB);
-pie-background: linear-gradient(#fff, #E7E8EB);    
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); /* box shadow */
-webkit-background-clip: padding-box;   /* smoother borders with webkit */ 
}

Thanks!

  • 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-05-30T05:42:59+00:00Added an answer on May 30, 2026 at 5:42 am

    What does “point” mean?

    Currently you set the center to $lat and $lng, but there is no marker(point?) at this position(unless inside $jsData will be the same coordinates).

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

Sidebar

Related Questions

All, In Apple's sample code DateCell http://developer.apple.com/library/ios/#samplecode/DateCell/Introduction/Intro.html the ivar pickerView is declared in MyTableViewController.h
All, Say I have the following bit of code: select: function(start, end, allDay) {
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'
All the code/commands below are part of a PHP script that processes images from
All example AVR programs I've ever seen start with code such as the following:
All, I'm trying to use the jQuery Form Validator (http://docs.jquery.com/Plugins/Validation). However I'd like to
All the articles I've found via google are either obsolete or contradict one another.
All I want is to update an ListViewItem's text whithout seeing any flickering. This
All, See the code below: function menu() { this.menuitem=[]; this.submenu=[]; this.menuitem[0] = $('div#sivname1'); this.menuitem[1]
All, I have some script tags that are not working in Wordpress. If I

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.