Jvectormap-悬停区域并在单击按钮时显示提示

时间:2018-12-28 14:42:09

标签: javascript jquery html google-chrome jvectormap

很抱歉我的假问题,但我需要帮助。我尝试将鼠标悬停在表中选择的区域,但是它仅在Firefox中有效,而在Chrome,IE,EDGE ...上不起作用。

如果有人可以帮助我,我将不胜感激!

 <table id="countries">
  <tr>
    <td id="PNZ">some_name</td>
    <td id="CRI">some-name</td>
  </tr>
 </table>
<div id="Map" style="width: 100%; height: 600px; position: relative;"> 
</div>

 function findRegion(robj, rname) {
     var code = '';
     $.each(robj, function (key) {
         if (unescape(encodeURIComponent(robj[key].config.name)) === unescape(encodeURIComponent(rname))) {
             code = key;
         };
     });
     return code;
 };
 $.getJSON('cdata.json', function (cdata) {
     $('#Map').vectorMap({
         map: 'ru_mill'
     });
     var mapObj = $('#RussiaMap').vectorMap('get', 'mapObject');

     $('#countries').on('click', 'tr > td', function (event) {
         // event.preventDefault();
         var elem = event.target,
             evtype = event.type,
             cntrycode = findRegion(mapObj.regions, $(elem).text());

         if (evtype === 'click') {
             mapObj.regions[cntrycode].element.setHovered(true);
         } else {
             mapObj.regions[cntrycode].element.setHovered(false);
         };
     });

0 个答案:

没有答案