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 7706457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:07:49+00:00 2026-06-01T00:07:49+00:00

I am not a clean CSS coder, so this may be the crux of

  • 0

I am not a clean CSS coder, so this may be the crux of my problem… but…I’ve cobbled together an interactive map from this tutorial: http://www.noobcube.com/tutorials/html-css/css-image-maps-a-beginners-guide-/.

My solution: http://www.paideiaschool.org/testing/barb_map.htm

I think I have the initial “rollovers” of the map working– (I’ve only coded the first two buildings in the upper left of the map) and am happy with that.

My problem is I want the legend of the map to do the same things as the rollovers of the map. I’ve come up with a clumsy solution that works (labeled ‘1509’), but not well in all browsers, and that tells me I have gone wrong somewhere.

I’m trying to avoid javascript as well.

What is the main problem?

  • 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-01T00:07:51+00:00Added an answer on June 1, 2026 at 12:07 am

    Here’s an updated jsFiddle for part one

    Here’s the basics:

    <div id="city-map">
        <a href="#" id="mac"><div class="pop-up">...</div></a>
        <a href="#" id="admin"><div class="pop-up">...</div></a>
        ...
    </div>
    

    We use an image map with anchor tags as “hot spots”. We use CSS to absolutely position these “hot spots” in the proper location and we do the basic background image sprite “trick”, the same you did in your original code.

    However, I updated your sprite image to have two “hover” images. When making an image hover map with none-square image spots (like buildings overlapping each-other), a single hover state runs into problems with a “neighbor” icon showing up in the hot spot slice. This is due to due HTML blocks being square and not being able to draw odd shapes. We solve this by having extra images states so you can make the neighbors still look un-highlighted.

    Pop-up box

    <div class="pop-up">
        <h1 class="title">Mac</h1>
        <div class="content">Some Content</div>
    </div>
    

    All the pop-up boxes have this HTML format. I position: absolute; them off to the side with the standard left:-999em; trick. I crafted the CSS to give them a standard pop-up location with a slight space between the hot-spot box and the pop-up box. This helps ensure your mouse will “hover out” of the hot-spot when reaching for a new hot-spot. Otherwise, you’ll hover over the pop-up box and it won’t go away until you over off both.

    <div id="city-map-legend">
        <div id="glamour-photo">
            <img src="..." id="mac-img" />
            <img src="..." id="admin-img"/>
            ...
        </div>
        <div id="cml-list">
            <h2>Around Campus</h2>
            <ul>
                <li><a id="mac-list" href="#">Mac</a></li>
                ...
            </ul>
        </div>
    </div>
    

    For the “map legend”, I have a group of “glamour images” and a list of links. Pretty standard stuff. The key is how they’re all tied together with their ID’s. JavaScript will use this to swap images and CSS states as we tie the three elements (map, glamour image, and list of links) together.

    ID’s in the map are the straight up ID name like “mac”. ID’s in the glamour images are “[id]-img” (ie. “mac-img”). And ID’s in the list are “[id]-list” (ie. “mac-list”).

    <script type="text/javascript" src="*"></script>
    * = http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
    

    I recommend using jQuery to help do easy JavaScript-ing and loading it from Google API for easy Content Delivery Network benefits.

    All that’s really left is the JavaScript event.

    $(document).ready(function() {
        // highlight map when legend link is hovered
        $('#cml-list a').hover(
            // hover over
            function(){
                // get id code
                var id = $(this).attr('id');
                // tokenize string to get main id code
                var tokens = id.split('-');
                id = '#' + tokens[0];
                // add active class to map id
                $(id).addClass('active');
            },
            // hover out
            function(){
                // clear all .active classes from map
                $('#city-map a').removeClass('active');
            }
        );
    });
    

    What happens above is we tell JavaScript to trigger anytime someone hovers a list link. There are two events when hovering, in and out.

    When someone hovers into a link, we get the base ID value from it and all we do is apply a CSS class “active” to the map “hot spot”.

    “.active” class will basically “turn on” the map item as if it was hovered (if you notice in the CSS, all the :hover selector styles are also shared with a ‘.active’ class).

    When we hover out, we simply tell jQuery to remove all ‘active’ classes. All that’s left to do is swap also write some code that does the same thing for the “glamour” images. Simply turning them on (display:block) or off (display:none). The one catch is that there should probably be a default image that we always turn back on if nothing else is selected unless we just want the previously activated glamour image to stay active, that works too.

    I’ve not gotten to that bit of code yet. I’ll see I can update it later and maybe leave a little bit for you to play around with.

    update

    • I developed it mostly in Chrome and a little Firefox. I just checked
      it in IE7/8/9 and it seemed to work fine.
    • I updated the jsFiddle to include glamour image swapping. I also had a small CSS bug where I placed the float in the wrong spot. So, work off the latest one.
    • NOTE I did not do the CSS for all the locations. I did several with some examples, but left the rest for you. =)

    Btw, I updated your map image and uploaded it on imgur.com => https://i.stack.imgur.com/zDzps.png

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

Sidebar

Related Questions

I'm sure there's a clean way to do this, but I'm probably not using
OK, so this may be getting too complicated for CSS/HTML to handle, but I
I found this site/tutorial/demo from another question here on SO. Very nice and clean
I am attempting to clean out a table but not get rid of the
So this is new, I'm trying to create clean CSS, here's my code example:
I'm trying to clean-up after an exception, and I'm not sure how to handle
Is there a simple way to not build the test classes? mvn clean install
It's not clear, to me anyway, if a UIView is automatically released from its
this is my code : <style type=text/css> #draggable { width: 100px; height: 100px; padding:
This is not the typical navigation found on other sites and I am having

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.