【发布时间】:2017-12-08 13:01:03
【问题描述】:
我在 wordpress 站点中有 4 个页面,我需要在其中包含 api yandex 地图。所以我创建了 4 个脚本,它们可以工作。我在页脚中包含了脚本标签:
<!-- Yandex map scripts -->
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="application/javascript"></script>
<script src="/wp-content/themes/bla" type="application/javascript"></script>
<script src="/wp-content/themes/blabla" type="application/javascript"></script>
<script src="/wp-content/themes/blablabla" type="application/javascript"></script>
<script src="/wp-content/themes/blablablabla" type="application/javascript"></script>
所有脚本都有不同的 div 块 ID,不同的变量名。 但是当我把我的 div 放在 4 页内时,只有第一个脚本在工作,在这个例子中,我只会在包含这个脚本的页面上看到地图
<script src="/wp-content/themes/bla" type="application/javascript"></script>
其他页面将为空白。
在浏览器中看起来像this,所以脚本不起作用
如果我在 1 个页面上加载所有 4 个地图,它就可以工作。但我希望每个地图都在某个页面上。
我应该怎么做才能让事情顺利进行?
【问题讨论】:
标签: javascript php wordpress yandex-maps