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

  • SEARCH
  • Home
  • 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 5847955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:47:30+00:00 2026-05-22T12:47:30+00:00

I have a US HTML image map with the states highlighted with coordinates. Each

  • 0

I have a US HTML image map with the states highlighted with coordinates. Each state when clicked will bring up a modal window with facilities locations.

Right now I have it where each state has an ID, the user clicks on the hotspot and then it loads the facilities locations with external HTML via jQuery .load() to lighten the document load.

Here’s an example in the JS

$('#Alabama').load('locations/Alabama.html');

and then the container that will load Alabama html in the main document is

<div class="overlay" id="Alabama"></div> 

As you can see I have to enter these in for each state. Obviously this is tedious and probably not the best method. DRY comes to mind but I’m not good at writing Javascript from the ground up.

What would be the best way to access the state IDs without writing each state instance? I’m thinking a JSON object with a click function that constructs the markup and calls the modal window. I’m just not sure where to begin.

  • 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-05-22T12:47:31+00:00Added an answer on May 22, 2026 at 12:47 pm

    If it’s a modal window, then you could probably just use the same overlay each time a state is clicked. So basically just do this…

    $(".overlay").load("locations/alabama.html");
    

    A full example might look something more like this though…

    $("area").click(function(){
       var url = $(this).attr("href");
       $(".overlay").load(url);
    });
    

    You may have to do something to prevent the browser default behavior of navigating on the clicked area. You could remove the href values and put them somewhere else…

    $("area").each(function(i, area){
       $(area).data("old-href", $(area).attr("href");
       $(area).attr("href","#");
    });
    //Then you do the same as above, but you get your url from the data method.
    $("area").click(function(){
       var url = $(this).data("old-href");
       $(".overlay").load(url);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML Mail template, with a place holder for the image. I
I have a string that is HTML encoded: '''&lt;img class=&quot;size-medium wp-image-113&quot;\ style=&quot;margin-left: 15px;&quot; title=&quot;su1&quot;\
Is there anyway to create an image map in Flash/Flex, and have it as
I have a sort of an image map, where I've used li's to create
I have following HTML text to show an image that contains a link: <img
I have a php class that generates a map image depending on my db
I have an image map with some clickable areas, and the plan is to
I have the following HTML to center images and links within a layer: edit:
I have the HTML given below: <ul id=thumbsPhotos> <li src=/images/1alvaston-hall-relaxing-lg.jpg onclick=updatePhoto (this.title)><img src=/images/1alvaston-hall-relaxing-sl.jpg width=56
We have to convert EVERYTHING to images for archiving purpose. DOC, HTML, email, ZIP,

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.