Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:05:20+00:00 2026-06-11T21:05:20+00:00

Its a very easy question and I am not web professional. I need to

  • 0

Its a very easy question and I am not web professional. I need to create an Interactive Map. I am using JQVMap. Now I need to click region and it will callback an URL of the state. I am giving and function that was given as example in the site. But I dont know how to setup the link with State and URLs.

jQuery(document).ready(function() {
    jQuery('#vmap').vectorMap({
        map: 'usa_en',
        backgroundColor: '#ffffff',
        color: '#333333',
        hoverColor: '#af090f',
        selectedColor: '#0076a3',
        enableZoom: true,
        showTooltip: true,
        scaleColors: ['#C8EEFF', '#006491'],
        onRegionClick: function(element, code, region)
        {
            var message = 'You clicked "'
                + region 
                + '" which has the code: '
                + code.toUpperCase();

            alert(message);
        }
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:05:21+00:00Added an answer on June 11, 2026 at 9:05 pm

    The onRegionClick callback contains everything you need to build your dynamic URL. It returns the click event itself, a 2 digit code representing the region you clicked, and the full name of the region you clicked. If you were using the US map for example and clicked on the state of Colorado, you would get back (regionClickEvent,’co’,’Colorado’)

    In the first example I built a dynamic url out of the region that was clicked and redirected you there. If the state name or code is not going to be part of the URL, you could do something like the second example where you check what region was clicked and handle it accordingly.

    You will need to update the URL to be specific to your needs, but hopefully this gives you and idea.

    * * ex.Use the region to build the url on the fly * *

    $('#vmap')
        .vectorMap({
        map: 'usa_en',
        onRegionClick: function (event, code, region) {
            window.location.replace("http://geology.com/state-map/" + region.toLowerCase() + ".shtml");
        }
    })
    

    * * ex.Check the region that was clicked and redirect based on some other rules * *

    $('#vmap')
        .vectorMap({
        map: 'usa_en',
        onRegionClick: function (event, code, region) {
            switch (code) {
            case "co":
                window.location.replace("http://www.google.com");
                break;
            case "ca":
                window.location.replace("http://www.yahoo.com");
                break;
            case "tx":
                window.location.replace("http://www.bing.com");
                break;
                }
            },
        onRegionOver: function (event, code, region) {
           document.body.style.cursor = "pointer";
            },
        onRegionOut: function (element, code, region) {
               document.body.style.cursor = "default";
            }
    })
    

    On the updated cursor stuff…if you don’t want to do it on every state, you can do the same check like we do onRegionClick, and check the code and see if it is a state that you want to show that style cursor on.
    Or, if there is a state that you don’t want to appear as clickable you could kill the event before it fires like this.

    onRegionOver: function (event, code, region) {
         if (code == "tx") 
              event.preventDefault();
         else 
              document.body.style.cursor = "pointer";
    },
    

    Anyway, Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need your help, may be this question is very easy for you. I
It's very easy to copy a javascript object in jQuery using jQuery.extend() function call.
I'm using MGTwitterEngine to add Twitter functionality to my app. It's very easy to
I'm tasked to create a web application. I'm currently using c# & asp.net (mvc
Before I have started to do web-programming I had thought it was easy. Now,
Ok, back with not necessarily a true definition of a question but need some
It's very easy to force a taskbar icon to display a balloon tooltip: all
It's very easy to set a text editor to use spaces or tab characters
The idea it's very easy, i have an http download class, this class must
I saw some handwarmer apps and I guess it's very easy to make something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.