user1413808
user1413808

Reputation: 11

Google maps API pan up onload

can't believe there isn't a simple answer to this, need this map to pan up automatically or some other way of stopping the info window disappearing out of the top of the map...

http://www.triangledesign.biz/contact-dev.php

code...

    var mapOptions = {
      center: new google.maps.LatLng(51.539104, -2.400264),
      zoom: 16,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

    var image = 'cup-sm.png';
    var myLatLng = new google.maps.LatLng(51.539104, -2.400264);
    var contentString = '<div id = "info-window">';
        contentString += '<div class = "float-left"><h1>Get in touch</h1></div>';
        contentString += '<div class ="divider4"><!--div--></div>';
        contentString += '<div class = "float-left">';
            contentString += 'Riverside House,<br>Quarry Road,<br>Chipping Sodbury,<br>Bristol BS37 6AX,<br>United Kingdom';
        contentString += '</div>';
        contentString += '<div class ="divider4"><!--div--></div>';
        contentString += '<div class = "float-left">';
            contentString += '<span class = "grey">t&nbsp;+44 (0)1454 311 220</span><br><a href ="mailto:[email protected]" class = "grey">[email protected]</a>';
        contentString += '</div>';
    contentString += '</div>';

    var image = new google.maps.MarkerImage("cup-sm.png",
    // This marker is 20 pixels wide by 32 pixels tall.
    null, 
    // The origin for this image is 0,0.
    new google.maps.Point(0,0)
    // The anchor for this image is the base of the flagpole at 0,32.

);


    var marker = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title:"Get In Touch",
          icon: image
      });

    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });

    $(document).ready(function(){
      infowindow.open(map,marker);
    });

Upvotes: 0

Views: 495

Answers (1)

Paulo Rodrigues
Paulo Rodrigues

Reputation: 5303

Well, just change the latitude in the property center on variable myOptions.

Set the center a little more to the south side.

I do not think there is another solution, since the information window is greater than half the map.

Upvotes: 1

Related Questions