Widget:Map: различия между версиями
Xunto (обсуждение | вклад) |
Xunto (обсуждение | вклад) |
||
| Строка 29: | Строка 29: | ||
<script> | <script> | ||
$(function(){ | $(function(){ | ||
| − | $('#world-map').vectorMap({map: 'test_map'}); | + | $('#world-map').vectorMap({ |
| + | map: 'test_map', | ||
| + | onRegionTipShow: function(e, el, code){ | ||
| + | console.log(el.html()) | ||
| + | } | ||
| + | }); | ||
}); | }); | ||
</script> | </script> | ||
Версия 04:04, 29 июля 2019
<script> var data = document.querySelector("#map_data").innerHTML; var state_map = {};
function processData(d) { while (d.length > 0) { var s = d.indexOf("("); var e = d.indexOf(")");
var page = d.substring(0, s - 1); var map = d.substring(s + 1, e);
d = d.substr(e + 3);
state_map[map] = page; } }
processData(data); </script>
<link rel="stylesheet" href="/resources/map/jquery-jvectormap-2.0.3.css" type="text/css" media="screen"/> <script src="/resources/map/jquery-3.4.1.min.js"></script> <script src="/resources/map/jquery-jvectormap-2.0.3.min.js"></script> <script src="/resources/map/test_map.js"></script>
<script> $(function(){ $('#world-map').vectorMap({ map: 'test_map', onRegionTipShow: function(e, el, code){ console.log(el.html()) } }); }); </script>