更新时间:2023-02-05 22:28:47
ha,因为您在之前触发调整大小事件 动画甚至开始:-)您必须等到它结束。为此,请使用 .animate的第四个参数 - 完成
回调这是在动画结束后调用的:
Ha ha because you trigger the resize event before the animation even starts :-) You have to wait until it ends. For this, use the 4th argument of .animate - the complete
callback which is called after the animation ends:
$('#add').click(function() {
$("#container-map").animate({
height: '50%',
minHeight: '50%'
}, 1500, function () {
google.maps.event.trigger(map, 'resize');
});
});