JQVMap - How do I set a state color in the USA Map?

丶灬走出姿态 提交于 2019-12-11 04:28:48

问题


My question is larger than the title. I want to apply transparency to most of the states and highlight about 6 states with a color.

The instructions on the github page are definitely written from a programmers POV. Can someone help me understand how I target individual states with CSS?

I tried, #jqvmap1_il {color:#930; background-color:#F60;} - which is targeting Illinois, but the inline CSS overrides the change.


回答1:


JQVMap's documentation says you should pass an object to the colors paramerter...

Colors of individual map regions. Keys of the colors objects are country codes according to ISO 3166-1 alpha-2 standard. Keys of colors must be in lower case.

Here is an example of how it can be done...

var highlighted_states = {
   il: '#f60',
   mo: '#f60',
   tx: '#f60',
   ut: '#f60',
}

jQuery('#vmap').vectorMap({
    map: 'usa_en',
    color: '#ffffff',
    colors: highlighted_states
});


来源:https://stackoverflow.com/questions/15510913/jqvmap-how-do-i-set-a-state-color-in-the-usa-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!