2010年7月31日 星期六

Google Map API 可以呼叫的事件

  • 'click'
  • 'dblclick'
  • 'mouseup'
  • 'mousedown'
  • 'mouseover'
  • 'mouseout'
  • 呼叫的方式如下

    var map; 
    function initialize() {
    var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
    var myOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    google.maps.event.addListener(map, 'zoom_changed', function() {
    setTimeout(moveToDarwin, 3000);
    });

    var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title:"Hello World!"
    });
    google.maps.event.addListener(marker, 'click', function() {
    map.setZoom(8);
    });
    }

    function moveToDarwin() {
    var darwin = new google.maps.LatLng(-12.461334, 130.841904);
    map.setCenter(darwin);
    }

    沒有留言:

    張貼留言

    Related Posts Plugin for WordPress, Blogger...
    // Dnow Function