InfoWindow不显示上面的标记Google Maps JavaScript API v3

InfoWindow不显示上面的标记Google Maps JavaScript API v3,javascript,jquery,google-maps,google-maps-api-3,Javascript,Jquery,Google Maps,Google Maps Api 3,因此,我创建了一个JSFIDLE来演示我的问题: 将鼠标悬停在我的JSFIDLE中的标记上,查看信息窗口的位置 我有一个谷歌地图“对象”,它创建谷歌地图。创建谷歌地图后,如下所示: var mapOptions = { zoom: 8, // The initial zoom level when your map loads (0-20) minZoom: 6, // Minimum zoom level allowed (0-20) maxZoom: 17, //

因此,我创建了一个JSFIDLE来演示我的问题: 将鼠标悬停在我的JSFIDLE中的标记上,查看信息窗口的位置

我有一个谷歌地图“对象”,它创建谷歌地图。创建谷歌地图后,如下所示:

  var mapOptions = {
    zoom: 8, // The initial zoom level when your map loads (0-20)
    minZoom: 6, // Minimum zoom level allowed (0-20)
    maxZoom: 17, // Maximum soom level allowed (0-20)
    zoomControl: true, // Set to true if using zoomControlOptions below, or false to remove all zoom controls.
    zoomControlOptions: {
        style: google.maps.ZoomControlStyle.DEFAULT // Change to SMALL to force just the + and - buttons.
    },
    //center: location, // Centre the Map to our coordinates variable
    mapTypeId: google.maps.MapTypeId.ROADMAP, // Set the type of Map
    scrollwheel: false, // Disable Mouse Scroll zooming (Essential for responsive sites!)
    // All of the below are set to true by default, so simply remove if set to true:
    panControl: false, // Set to false to disable
    mapTypeControl: false, // Disable Map/Satellite switch
    scaleControl: false, // Set to false to hide scale
    streetViewControl: false, // Set to disable to hide street view
    overviewMapControl: false, // Set to false to remove overview control
    rotateControl: false // Set to false to disable rotate control
}

if (this.instances.length > 0) {
    return this.instances.pop();
}

var googleMap = new GoogleMap();
googleMap.map = new google.maps.Map(googleMap.mapCanvas, mapOptions);
return googleMap;
然后,我将JS“object”中的一个var设置为返回的googleMap值

然后我使用this.map(这是从上述代码返回的googleMap)在地图上设置一个标记:

 this.latitude = latitude;
this.longitude = longitude;

var location = new google.maps.LatLng(latitude, longitude);

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

this.marker = new google.maps.Marker({
    position: location,
    map: this.map,
});

this.map.setCenter(location);

google.maps.event.addListener(this.marker, 'mouseover', function () {
    infowindow.open(this.map, this.marker);
});

google.maps.event.addListener(this.marker, 'mouseout', function () {
    infowindow.close(this.map, this.marker);
});
问题是信息窗口没有显示在标记上方,请参见my JSFIDLE:
将鼠标悬停在my JSFIDLE中的标记上,查看信息窗口的位置。

在鼠标悬停侦听器中使用此标记时,此标记未定义。在click listener函数中,“this”是标记

google.maps.event.addListener(this.marker, 'mouseover', function () {
    infowindow.open(this.getMap(), this);
});

this.marker在鼠标悬停侦听器中使用时未定义。在click listener函数中,“this”是标记。你这个摇滚人!你完全正确,只是把这个。标记改成了这个,一切都好了。我怎样才能使一个未定义的窗口在标记上方?