Git Product home page Git Product logo

Comments (5)

johnnyr209 avatar johnnyr209 commented on September 27, 2024

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

from us-map.

eweisbrot avatar eweisbrot commented on September 27, 2024

I used this:

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

from us-map.

 avatar commented on September 27, 2024

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

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

from us-map.

gbdg avatar gbdg commented on September 27, 2024

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.

from us-map.

activeiron avatar activeiron commented on September 27, 2024

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>

from us-map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.