Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Disable states? #5

Open
randalthesecond opened this issue Dec 10, 2012 · 2 comments
Open

Disable states? #5

randalthesecond opened this issue Dec 10, 2012 · 2 comments

Comments

@randalthesecond
Copy link

Is there a way that I can disable certain states?

@mlammert
Copy link

From what I can tell there is not a specific way to disable a state. But, what I did was create a stateSpecificStyles and a stateSpecificHoverStyles that were the same fill color of a light gray. So, the state is light gray to begin with and when you hover over it, it is the same light gray thus making it seem disabled.

Hope this works for you!

@designer-rohit
Copy link

Yes you can use this code:

// Disable States
var States = {'AR': '/arkansas-fire-extinguisher-tag','CA': '/california-fire-extinguisher-tag','FL': '/florida-fire-extinguisher-tag','GA': '/georgia-fire-extinguisher-tag','IL': '/illinois-fire-extinguisher-tag','KS': '/kansas-fire-extinguisher-tag','LA': '/louisiana-fire-extinguisher-tag','MA': '/massachusetts-fire-extinguisher-tag','MT': '/montana-fire-extinguisher-tag','NV': '/nevada-fire-extinguisher-tag','NJ': '/new-jersey-fire-extinguisher-tag','NY': '/new-york-fire-extinguisher-tag','TX': '/texas-fire-extinguisher-tag', };

// for enable states
var enableStates = 'AR,CA,FL,GA,IL,KS,LA,MA,MT,NV,NJ,NY,TX'.split(',');
var stateSpecificStyles = {},
stateSpecificHoverStyles = {};

// style for specificStates
for (var i = 0; i < enableStates.length; i++){
stateSpecificStyles[enableStates[i]] = { fill: '#eef3fc', stroke: '#336699', 'stroke-width': 0.5,cursor: 'default'};
stateSpecificHoverStyles[enableStates[i]] = { fill: '#D5D1FF', stroke: '#336699', 'stroke-width': 1,cursor: 'default'};
}
$('#us-map').usmap({
'stateStyles': { fill: 'white', stroke: '#336699'},
'stateHoverStyles': { fill: 'white', stroke: '#336699'},
'stateSpecificStyles': stateSpecificStyles,
'stateSpecificHoverStyles': stateSpecificHoverStyles
});

Hope this works for you!
All the best 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants