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

how to add links to states #45

Open
RawContent opened this issue Nov 27, 2014 · 5 comments
Open

how to add links to states #45

RawContent opened this issue Nov 27, 2014 · 5 comments

Comments

@RawContent
Copy link

hello,
im newbie here, i wonder how can i add link to each state, by clicking it moves to the targeted link
and thank you

@johnnyr209
Copy link

Did you figure out how to link each state to a URL?

@eweisbrot
Copy link

I used this:

click: function(event, data) {
if (data.name == "AL") {
window.location = "/surety-bonds/licensed-states/alabama_surety_bond.htm";
}

@ghost
Copy link

ghost commented Mar 18, 2015

@eweisbrot thanks for writing that, helped me a ton!

         if (data.name == "UT") {
           $('#ut').toggle();
        }
          else {
            $('#ut').hide();
        }

@gbdg
Copy link

gbdg commented Nov 6, 2015

We have the logic referenced in the Jan 22 post (above) working successfully. We also have logic to highlight a state, as shown below, from another post. Both of these work fine.
'AL' : { fill: '#950000'},

Might I ask how to implement both the link and the highlighting logic for the Northeastern states?

We have wrapped the highlighting logic and the link logic with IF statements that are only true when at least on dealer is present for a given state. I want to enforce the same logic against the icons for the NE states.

@activeiron
Copy link

Hi I am trying to implement on click URL with three other functions. But I am having issues with the click: function. Can please gudie me with my code.

<script> $(document).ready(function() { $('#map').usmap({ stateSpecificStyles: { 'ME': {fill: 'red'}, 'WI': {fill: 'red'}, 'MT': {fill: 'red'} }, stateSpecificHoverStyles: { 'ME': {fill: 'green'}, 'WI': {fill: 'green'}, 'MT': {fill: 'green'}
},
// Show tooltip when hovering over state
mouseover: function(event, data) {
    $('#tooltip').text(data.name+"test").show();
    $('#map').mousemove(function(e){
        var mouseX = e.pageX -10;
        var mouseY = e.pageY -30;
        $('#tooltip').css({
            top:mouseY,
            left:mouseX,
            'position': 'absolute',
            'border':'1px solid black',
            'background': '#fff',
            'color': '#ffffff',
            'font-size': '1.5 em',
            'padding': '5px',
            'opacity': '0.75',
            'border-radius': '2px'
        });
    });
}, 

click: function(event, data) {  	
	if (data.name == "AL") {
	window.location =="https://www.google.com/";
	}
  });
});
</script>
</div>

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

5 participants