Results 1 to 2 of 2

Thread: Google maps marker slightly off center

  1. #1
    Join Date
    Jun 2016
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Google maps marker slightly off center

    Hi ,

    Having just one little problem with google maps. When ever i search a location the marker is always a slightly off center. Take a look at the gif to understand my problem more. As you can see when a search for location has been entered the location comes up but the marker is not placed on the correct location.
    when using this html code by it self it works. but when using this inside a template in wordpress i'm getting the problem where the marker is not centered.

    even on codepen the marker is working and is centered back to position when a location has been searched, but using the same code in a template with wordpress i'm getting the above problem i explained. could this be a css problem or a interference with the template(newsmag). The white address info box is showing correctly, the marker should be beneath that Address box but as you can see in the gif the marker slightly goes to a different location.

    any help would be great. I put everything on codepen hope this is a simple solution.

    Thanks in advance
    Last edited by jadwal; 10-13-2016 at 05:17 PM.

  2. #2
    Join Date
    Jun 2016
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Finally fixed the problem. It was the label all this time. removed this 2 lines in the eqibla.js file and everything is working fine.

    remove these two lines.
    Code:
    		//if (!hideInfo && this.getMapType() != 'e' && place.address != '' && this.map.getSize().height > 340)
    			//this.map.openInfoWindowHtml(this.home, '<h4>Address:</h4><p>'+ place.address+ '</p>');
    Code:
    // show address on map
    Qibla.showAddressOnMap = function(response, hideInfo) {
    	if (!response || response.Status.code != 200) {
    		if (!this.map.isLoaded())
    			this.map.setCenter(this.home, 1*this.mapZoom);
    		else
    			alert('Adres niet gevonden');
    	}
    	else {
    		var place = response.Placemark[0];
    		this.home = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
    		var zoom = 4+ parseInt(1.5* place.AddressDetails.Accuracy);
    		zoom = Math.min(zoom, this.map.getCurrentMapType().getMaximumResolution());
    		this.map.setCenter(this.home, zoom);
    		this.redraw();
    		//if (!hideInfo && this.getMapType() != 'e' && place.address != '' && this.map.getSize().height > 340)
    			//this.map.openInfoWindowHtml(this.home, '<h4>Address:</h4><p>'+ place.address+ '</p>');
    	}
    }

Similar Threads

  1. Replies: 2
    Last Post: 08-25-2014, 01:14 PM
  2. Google Maps
    By frankym in forum JavaScript
    Replies: 2
    Last Post: 02-03-2010, 05:05 AM
  3. Page Center - Slightly Off
    By DawgMom in forum CSS
    Replies: 1
    Last Post: 01-23-2010, 01:22 AM
  4. help with JS and google maps
    By puremetal in forum JavaScript
    Replies: 0
    Last Post: 05-15-2007, 10:30 AM
  5. Google maps
    By Maestre in forum JavaScript
    Replies: 1
    Last Post: 03-26-2007, 06:28 PM

Bookmarks

Posting Permissions

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