使用高级自定义字段填充jqvmap

时间:2017-01-26 22:59:05

标签: wordpress advanced-custom-fields jqvmap

我正在尝试使用Advanced {{{{{{{

我尝试根据我设置的自定义字段将她的教程从全局地图调整到美国地图。

地图渲染正确但悬停时的工具提示使用默认显示,但不输出自定义字段。 (为简单起见,我将自定义字段缩减为一个。)

最大的变化是我必须包含每个州才能让地图呈现。

states =["al","ak","az","ar","ca","co","ct","de","fl","ga","hi","id","il","in","ia","ks","ky","la","me","md","ma","mi","mn","ms","mo","mt","ne","nv","nh","nj","nm","ny","nc","nd","oh","ok","or","pa","ri","sc","sd","tn","tx","ut","vt","va","wa","wv","wi","wy"];
if (states.indexOf(code) <= -1) { 

有谁能告诉我我做错了什么?

<script>
  jQuery(document).ready(function () {
    jQuery('#vmap').vectorMap({
      map: 'usa_en',
      backgroundColor: '#ffffff',
      borderColor: '#f7f7f7',
      borderOpacity: 1.0,
      borderWidth: 2,
      color: '#acbea3',
      enableZoom: false,
      showTooltip: true,
      selectedColor: null,
      hoverColor: '#d5ded1',
      hoverOpacity: 0.85,
      onLabelShow: function(event, label, code) {
    states =["al","ak","az","ar","ca","co","ct","de","fl","ga","hi","id","il","in","ia","ks","ky","la","me","md","ma","mi","mn","ms","mo","mt","ne","nv","nh","nj","nm","ny","nc","nd","oh","ok","or","pa","ri","sc","sd","tn","tx","ut","vt","va","wa","wv","wi","wy"];
    if (states.indexOf(code) <= -1) { 
            <?php $i=1; if( have_rows('impact_data') ): while ( have_rows('impact_data') ) : the_row(); ?>

                <?php if($i==1) echo 'if'; else echo 'else if'; ?>(code == '<?php the_sub_field('ei-code'); ?>') {
                    label.html('<h1><?php the_sub_field('ei-state'); ?></h1>');
                }

            <?php $i++; endwhile; endif; ?>
    }
  },
  onRegionClick: function(element, code, region) {
    window.location.replace("http://google.com/" + region.toLowerCase() + "/");
}
    });
  });

0 个答案:

没有答案