使用jQuery fadeIn和fadeOut的Google Maps API V3 InfoBox

int*_*e25 8 jquery google-maps fade openinfowindowhtml infowindow

我在网上搜索得很高,并且无法找到使用jQuery来淡化Google地图中的InfoBox/InfoWindow而不是实际框/窗口内容的教程或示例.这是我的代码,我不确定我做错了什么,但似乎也不对.

google.maps.event.addListener(marker, 'mouseover', function() {
    ib.setContent(html);
    ib.open(map, marker);
    ib.setValues({type: "point", id: 2})

   var idName = marker.get("id"); //I was trying to the id's of the elements here 
   var boxName = ib.get("id");    //to use in my jQuery

   jQuery(idName ).mouseover(function() {
      jQuery(boxName ).fadeIn('slow', function() {
    // Animation complete
   });
  });

});
Run Code Online (Sandbox Code Playgroud)

int*_*e25 12

实际上可以淡化信息框,你必须覆盖infobox.js文件中的draw函数,就像这样

var oldDraw = ib.draw;
ib.draw = function() {
   oldDraw.apply(this);
   jQuery(ib.div_).hide();
   jQuery(ib.div_).fadeIn('slow'); 
}
Run Code Online (Sandbox Code Playgroud)


Jan*_*Jan 5

我为网站尝试了类似的东西.这是我的代码.(GM-API-V3)

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

function iwFadeIn() {
    infowindow.open(map, marker);
    var iw_container = $(".gm-style-iw").parent();
    iw_container.stop().hide();
    iw_container.fadeIn(1000);
}
Run Code Online (Sandbox Code Playgroud)