gpt4 book ai didi

javascript - Google Maps API 中的 GDirections.loadFromWaypoints 后触发事件

转载 作者:行者123 更新时间:2023-11-30 18:59:27 25 4
gpt4 key购买 nike

我正在尝试向 Google Maps API 返回到指定 div (directionsPanel) 的路线结果中添加一些文本。下面的代码可以正常工作,除了 jQuery 行在 loadFromWaypoints 完成修改 DOM 之前触发。如果我在路线内容完成加载后通过手动触发来运行该行,它将按预期执行。

directions = new GDirections(map, directionsPanel);
directions.loadFromWaypoints(waypoints);

$("td[@jscontent='address']").append(" some content");

如何在 DOM 完成重新加载后添加某种监听器(可能在 loadFromWaypoints 回调函数或 directionsPanel div 本身上)来执行我的 jQuery 行?

最佳答案

文档不是很好,但它讨论了“load”和“addoverlay”事件 http://code.google.com/apis/maps/documentation/reference.html#GDirections

GEvent.addListener(directions, "addoverlay", function() {
$("td[jscontent='address']").append(" some content");
});

关于javascript - Google Maps API 中的 GDirections.loadFromWaypoints 后触发事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/337585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com