1

I am using jVectorMap library and its working fine. But i don't want to show country name when mouse hover over the map.

// worldMap is the container
  $('#worldMap').vectorMap({
                    map: 'world_mill_en',
                    backgroundColor : 'transparent',
                    zoomOnScroll: false,
                    zoomButtons : false
    });

Currently its showing country name when we hover over the map. I want do disable this functionality.

http://jsfiddle.net/3xZ28/238/

Any help is greatly appreciated.

0

3 Answers 3

11

Old post, but as of v2.0.3, the event, onRegionLabelShow, has been changed to onRegionTipShow. Same goes for onMarkerLabelShow = onMarkerTipShow

onRegionTipShow: function (e, label, code) {
    e.preventDefault();
}
2

http://jsfiddle.net/3xZ28/243/

onRegionLabelShow: function(e, el, code){
    e.preventDefault();
}
10
  • create a jsfiddle please. I will try to provide some help. ;)
    – Mr.TK
    Feb 28, 2014 at 8:25
  • i have added a jsfiddle, please have a look at it. Also, onRegionOver is not working. Feb 28, 2014 at 8:45
  • One more time edited my answer - this solution can messup some of primary functions of this vector map so be careful.
    – Mr.TK
    Feb 28, 2014 at 9:04
  • thnx, it helped me a lot. Feb 28, 2014 at 9:57
  • 1
    i think, css is a good approach to do that as suggested by you. Feb 28, 2014 at 10:25
1

After, taking help from @Mr.TK answer and further googling. I found the solution:

$('#worldMap').vectorMap({
     map: 'world_mill_en',
     backgroundColor: 'green',
     normalizeFunction: 'polynomial',
     zoomOnScroll: false,
     zoomButtons: false,
     regionStyle: {
         hover: {
             "fill-opacity": 1
         }
     },
     onRegionLabelShow: function (e, el, code) {
         e.preventDefault();
     },
     markers: [{
         latLng: [37.7833, -122.4167],
         name: 'San Francisco'
     }]
 });

This is what, i am looking for: http://jsfiddle.net/3xZ28/244/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.