• Resolved tag101

    (@tag101)


    Hi just wondering if I can offset the center of a map to show the marker towards the bottom because its mostly ocean when its centered on the marker itself in the case of my map.

    Jimmy

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tag101

    (@tag101)

    Hi I think I sorted this, sorry for bothering you.

    In plugin folder in the file called simple-google-map-short-code.php I changed some javascript as below.

    var map_<?php echo $map_id; ?>;
    function pw_run_map_<?php echo $map_id ; ?>(){
    var location = new google.maps.LatLng("<?php echo $coordinates['lat']; ?>", "<?php echo $coordinates['lng']; ?>");
    
    // Added a new variable (set your own lat and long)
    var latlng = new google.maps.LatLng(52.0,  -7.0);
    
    var map_options = {
    zoom: <?php echo $atts['zoom']; ?>,
    
    Original //center: location,
    // New to call variables
    center: latlng,
    
    scrollwheel: <?php echo 'true' === strtolower( $atts['enablescrollwheel'] ) ? '1' : '0'; ?>,
    disableDefaultUI: <?php echo 'true' === strtolower( $atts['disablecontrols'] ) ? '1' : '0'; ?>,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map_<?php echo $map_id ; ?> = new google.maps.Map(document.getElementById("<?php echo $map_id ; ?>"), map_options);
    				var marker = new google.maps.Marker({
    				position: location,
    				map: map_<?php echo $map_id ; ?>
    				});
    			}
    			pw_run_map_<?php echo $map_id ; ?>();
    

    Might help someone.

    Jimmy

    • This reply was modified 7 years, 2 months ago by tag101.

    Hi Jimmy,

    There is not an option for this, sorry.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Offset Map Center’ is closed to new replies.