Results 1 to 5 of 5

Thread: Tooltip for Image Map?

  1. #1
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    264
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default Tooltip for Image Map?

    Hi,
    I'm looking for some sort of script that would allow me to have caption boxes when mousing over different sections of an image. For example, here is the test page with the image: http://cisflorida.org/model2.html.

    When you mouse over the different parts of the image, such as the number 1, a caption box would appear with details. A different box would appear when mousing over the image section with the number 2, etc.

    Thanks,
    Deborah
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  2. #2
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    It's very simple, no need for a script just basic HTML. All you do is create an image map for your image and add 'title=".."' tags inside each <area ...> tag like this:

    Code:
    <img src="YourImage.jpg" alt="!" usemap="#numbers">
    
    
    <map name="numbers">
     <area shape="circle" coords="x1,y1,radius1" href=".." title="1">
     <area shape="circle" coords="x2,y2,radius2" href=".." title="2">
     <area shape="circle" coords="x3,y3,radius3" href=".." title="3">
     <!-- etc. etc.-->
    </map>
    More info here.

    Edited to add: I looked at the source code of your page and noticed that the image is linked to a map named "model" but you have no such map in your page. The map immediately after the image is named "homepage", so won't work!
    Last edited by styxlawyer; 09-17-2015 at 07:57 PM. Reason: Additional info.

  3. The Following 2 Users Say Thank You to styxlawyer For This Useful Post:

    dmwhipp (09-23-2015),james438 (09-17-2015)

  4. #3
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there dmwhipp,


    there is no need for javascript, image map or title attribute.

    Instead, we can just let CSS take the strain...

    Code:
    
    <!DOCTYPE html>
    <html  lang="en">
    <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <title>CSS tooltip example</title>
    
    <style media="screen">
    #dmwhipp {
        position:relative;
        width:890px;
        height:779px;
        padding:0;
        margin:0 auto;
        background-image:url(http://cisflorida.org/graphics/model/model-min.gif);
        list-style-type:none;
     }
    #dmwhipp li {
        position:absolute;
     }
    #dmwhipp li:hover div {
        display:block;
     }
    #dmwhipp a {
        display:block;
        width:77px;
        height:77px;
        border-radius:50%;
     }
    #dmwhipp div {
        display:none;
        position:absolute;
        box-sizing:border-box;
        width:216px;
        height:166px;
        padding:10px;
        border:1px solid #b7d6e9;
        border-radius:10px;
        background-color:#fff;
        background-image:linear-gradient(to bottom,#fff,#b7d6e9);
        box-shadow:inset 0 0 20px #999,4px 4px 4px #999;
        color:#669;
     }
    #one {
        top:240px;
        left:521px;
     }
    #one div {
        top:143px;
        right:44px;
     }
    #two {
        top:353px;
        left:633px;
     }
    #two div {
        top:29px;
        right:156px;
     }
    #thr {
        top:494px;
        left:659px;
     }
    #thr div {
        top:-112px;
        right:182px;
     }
    #fou {
        top:494px;
        left:158px;
     }
    #fou div {
        top:-112px;
        left:180px;
     }
    #fiv {
        top:353px;
        left:181px;
     }
    #fiv div {
        top:29px;
        left:157px;
     }
    #dmwhipp h6 {
        margin:10px 0;
        text-align:center;
        text-transform:uppercase;
     }
    #dmwhipp p {
        font-size:75%;
     }
    </style>
    
    </head>
    <body>
    
    <ul id="dmwhipp">
     <li id="one">
      <a href="#"></a>
       <div>
        <h6>assessment</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="two">
      <a href="#"></a>
       <div><h6>planning</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="thr">
      <a href="#"></a>
       <div>
        <h6>support</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="fou">
      <a href="#"></a>
       <div><h6>monitoring</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="fiv">
      <a href="#"></a>
       <div>
        <h6>evaluation</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
    </ul>
    
    </body>
    </html>

    coothead
    ~ the original bald headed old fart ~

  5. The Following User Says Thank You to coothead For This Useful Post:

    dmwhipp (09-23-2015)

  6. #4
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    264
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default

    Thanks!
    Quote Originally Posted by coothead View Post
    Hi there dmwhipp,


    there is no need for javascript, image map or title attribute.

    Instead, we can just let CSS take the strain...

    Code:
    
    <!DOCTYPE html>
    <html  lang="en">
    <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <title>CSS tooltip example</title>
    
    <style media="screen">
    #dmwhipp {
        position:relative;
        width:890px;
        height:779px;
        padding:0;
        margin:0 auto;
        background-image:url(http://cisflorida.org/graphics/model/model-min.gif);
        list-style-type:none;
     }
    #dmwhipp li {
        position:absolute;
     }
    #dmwhipp li:hover div {
        display:block;
     }
    #dmwhipp a {
        display:block;
        width:77px;
        height:77px;
        border-radius:50%;
     }
    #dmwhipp div {
        display:none;
        position:absolute;
        box-sizing:border-box;
        width:216px;
        height:166px;
        padding:10px;
        border:1px solid #b7d6e9;
        border-radius:10px;
        background-color:#fff;
        background-image:linear-gradient(to bottom,#fff,#b7d6e9);
        box-shadow:inset 0 0 20px #999,4px 4px 4px #999;
        color:#669;
     }
    #one {
        top:240px;
        left:521px;
     }
    #one div {
        top:143px;
        right:44px;
     }
    #two {
        top:353px;
        left:633px;
     }
    #two div {
        top:29px;
        right:156px;
     }
    #thr {
        top:494px;
        left:659px;
     }
    #thr div {
        top:-112px;
        right:182px;
     }
    #fou {
        top:494px;
        left:158px;
     }
    #fou div {
        top:-112px;
        left:180px;
     }
    #fiv {
        top:353px;
        left:181px;
     }
    #fiv div {
        top:29px;
        left:157px;
     }
    #dmwhipp h6 {
        margin:10px 0;
        text-align:center;
        text-transform:uppercase;
     }
    #dmwhipp p {
        font-size:75%;
     }
    </style>
    
    </head>
    <body>
    
    <ul id="dmwhipp">
     <li id="one">
      <a href="#"></a>
       <div>
        <h6>assessment</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="two">
      <a href="#"></a>
       <div><h6>planning</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="thr">
      <a href="#"></a>
       <div>
        <h6>support</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="fou">
      <a href="#"></a>
       <div><h6>monitoring</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
     <li id="fiv">
      <a href="#"></a>
       <div>
        <h6>evaluation</h6>
         <p>
           Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec 
           ultricies sollicitudin nisi, ut molestie felis adipiscing sit 
           amet.
         </p>
       </div>
     </li>
    </ul>
    
    </body>
    </html>

    coothead
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  7. #5
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    264
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default

    Thank you!

    Quote Originally Posted by styxlawyer View Post
    It's very simple, no need for a script just basic HTML. All you do is create an image map for your image and add 'title=".."' tags inside each <area ...> tag like this:

    Code:
    <img src="YourImage.jpg" alt="!" usemap="#numbers">
    
    
    <map name="numbers">
     <area shape="circle" coords="x1,y1,radius1" href=".." title="1">
     <area shape="circle" coords="x2,y2,radius2" href=".." title="2">
     <area shape="circle" coords="x3,y3,radius3" href=".." title="3">
     <!-- etc. etc.-->
    </map>
    More info here.

    Edited to add: I looked at the source code of your page and noticed that the image is linked to a map named "model" but you have no such map in your page. The map immediately after the image is named "homepage", so won't work!
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

Similar Threads

  1. Image w/ description tooltip v2.0 - Image fade-in and out possible?
    By vegeman in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 12-09-2013, 06:04 PM
  2. Replies: 0
    Last Post: 11-26-2008, 11:32 AM
  3. Rich HTML Balloon Tooltip > tooltip inside of another tooltip?
    By croceldon in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-24-2008, 03:35 PM
  4. Image w/ description tooltip or Image Thumbnail Viewer
    By rizquine in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 04-07-2006, 04:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •