I'm using jVectorMaps. I have a map object with a backgroundColor property:
map = new jvm.Map({
container: $('#map'),
map: "world_mill_en,
backgroundColor: bgcolor
Let's say I declare a global bgcolor
variable. Then, I change the value of that variable at some point:
function changeBGcolor() {
bgcolor = "yellow";
}
The idea is that the jVectorMap background color changes when I change the value of the bgcolor
variable. So far I was not able to do it.
How can it be done?
You should use setBackgroundColor()
. i.e.
var bgColor = "red";
var map = new jvm.Map({
container: $('#map'),
map: 'world_mill_en',
backgroundColor: bgColor
});
bgColor = "yellow";
map.setBackgroundColor(bgColor);
See the documentation here for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With