JVectormap is installed in hover state from link

I made a custom map with JVectormap and added a list of links with the same states in another div on the same page.

<div id="mylinks">
    <a href="#" id="state1" >State1</a>
    <a href="#" id="state2" >State2</a>
    <a href="#" id="state3" >State3</a>
</div>

      

When I hover over the links, I want to activate the hoverstate on the map. How can I tell jvectormap from outside to activate the state?

$('a').mouseover(function (e) {
  var id = $(e.target).attr('id');
  switch (id){
    case "state1":
    // Set State1 in Hovermode
    break;
    .
    .
    . 
    }
});

      

+3


source to share


1 answer


Try the following:

Get a link to a map object

map = $("#world-map-gdp").vectorMap('get', 'mapObject');

      

Use this method



map.setSelectedRegions(['IT']);

      

In my case, hover over Italy

I'm not sure if this exists in all types of maps, but in the world it exists and works.

+1


source







All Articles