Search code examples
jqueryjqvmap

vmap: how to color selected countries only


I am using jQuery VMap and it works fine with this code

    jQuery('#vmap2').vectorMap({
        map: 'world_en',
        backgroundColor: '#fff',
        color: '#9e2842',
        hoverOpacity: 0.6,
        selectedColor: '#8B0000',
        enableZoom: true,
        showTooltip: true,
        values: sample_data,
        scaleColors: ['#D35471', '#691B2D'],
            selectedRegion: null,
        normalizeFunction: 'polynomial',
        onRegionClick: function(element, code, region)
        {

            if (region == "Singapore") {
               document.getElementById('mailblock').innerHTML = 'Contact Information for Singapore :';
            }
            if (region == "HongKong") {
               document.getElementById('mailblock').innerHTML = 'Contact Information    for HongKong :';
            }
        }
    });

Now I want to change the color of selected countries only say 5-6 countries on hover.


Solution

  • got the answer

    jQuery('#vmap2').vectorMap('set', 'colors', { au: '#9e2842'});
    

    it works