JQVMap-如何在“美国地图"中设置状态颜色? [英] JQVMap - How do I set a state color in the USA Map?

查看:195
本文介绍了JQVMap-如何在“美国地图"中设置状态颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题大于标题.我想对大多数州应用透明度,并用颜色突出显示大约6个州.

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.

github页面上的指令肯定是由程序员POV编写的.有人可以帮助我了解我如何使用CSS定位各个州吗?

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?

我尝试了#jqvmap1_il {color:#930; background-color:#F60;}-定位于伊利诺伊州,但内联CSS会覆盖更改.

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

推荐答案

JQVMap的文档说您应该将对象传递给colors参数...

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

各个地图区域的颜色.颜色对象的键 是根据ISO 3166-1 alpha-2标准的国家/地区代码.的键 颜色必须小写.

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
});

这篇关于JQVMap-如何在“美国地图"中设置状态颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆