NewSignature / us-map

An interactive map of the United States using Raphaël
BSD 2-Clause "Simplified" License
280 stars 184 forks source link

Customization issues #38

Open claustraphobia opened 10 years ago

claustraphobia commented 10 years ago

Can't seem to customize this map how I want it... Obviously it can be done because the demo map on the main site looks nothing like mine.Here is my site: http://whitetaillandsales.com/ I am trying to change the color of the map, I was able to finally get the hover style to change from the default blue to red, but if I put in the code to change the map color, one cancels out the other. Like I can only have one style. $('#map').usmap({ stateStyles: {fill: 'blue'} }); $('#map').usmap({ stateHoverStyles: {fill: 'red'} });

Also, is there a way to eliminate the box color around the smaller states?

And last but not least, viewing the map on my android phone, nothing happens when you click on the states, only the hover color shows. I have a click event set for each state to go to its own page. Works great on desktop, but does not click on the phone....

bobsawyer commented 10 years ago

Claustrophobia, not sure if you've found the fix for this or not, but you only need one declaration, with the various options contained within, like so:

$('#map').usmap({ stateStyles: {'fill': 'blue'}, stateHoverStyles: {'fill': 'red'} });

If you have multiple style settings for, let's say, states, you include them within the {}:

stateStyles: { 'fill': 'blue', 'stroke': 'white', 'stroke-width': '1' }

Also, you have to surround the style names with quotes, otherwise you'll get an error on 'stroke-width' -- I guess because of the hyphen.