jmootips and Image Maps

jmootipsIn HTML and XHTML, an image map is a list of coordinates relating to a specific image, created in order to hyperlink areas of the image to different destinations (as opposed to a normal image link, in which the entire area of the image links to a single destination). For example, a map of the world may have each country hyperlinked to further information about that country. The intention of an image map is to provide an easy way of linking various parts of an image without dividing the image into separate image files.

In HTML an image map is made of the actual image, that is embedded with the <img>-tag. The image has to be assigned the attribute "usemap".
The image map comprise a <map>-tag and in the detail of the <area>-tags, which defines the fields with optional weblinks. These are similar to the <a>-Tag defining which URL should be opened.

A Sample of Image Map below:

<img src="/images/stories/lakes.jpg" alt="" width="450" height="339" border="0" usemap="#Map" />
<map name="Map" id="Map">
 <area shape="rect" coords="120,85,156,118" nohref alt="Lake Superior" />
 <area shape="rect" coords="142,206,179,237" href="##" alt="Lake Michigan" />
...
</map>

 

Image Map with Tooltips

With jmootips Version 1.1.1 you may add tooltips within images using image maps. (Note: This feature is not available if Bootstrap Javascript Framework used for jmootips. Also it may happen, that Microsoft's Internet Explorer does not display tooltips at all. For a solution for Bootstrap and Internet Explorer see next chapter of this article).
To add tooltips to be used with image maps, embed <area>-tags with tooltip tags:
{tip id="127" position="above"}<area shape="rect" coords="120,85,156,118" href="##" />{/tip}
jmootips will use the shape-attribute and coords-attribute to position tooltips within image.

Sample of Image Map with Tooltips

To show tip, move mouse pointer onto question marks within image:

Lake Huron Lake Erie Lake Ontario

Image Map defined with HTML/CSS Settings

The Bootstrap Javascript Framework with its tooltip plugins does not position tooltips correctly if an image map with <area>-tags is used. There is a solution to solve this problem by "translating" HTML <img>-tag and <area>-tags to HTML- and CSS-settings.
This way to provide tooltips within an image works as well with the Mootools Javascript Framework. Below three steps describe (using a sample image) how to implement this solution:
  1. Redefine your <img>-tag to a <div>element:
    <img src="/images/stories/lakes.jpg" alt="" width="450" height="339" border="0" usemap="#Map" />
    
    translates to:
    <div style="position:relative;width:450px;height:339px;background-image:url(/images/stories/lakes.jpg);">
    
  2. Redefine <area>-tags:
    <area shape="rect" coords="120,85,156,118" href="#" alt="Lake Superior" />
    
    translates to:
    <a href="#" style="opacity:0;position:absolute;top:85px;left:120px;width:20px;height:15px"></a>
    
  3. with embedded tooltip tags your new "image map" would look like:
    <div style="position:relative;width:450px;height:339px;background-image: url(/images/stories/lakes.jpg);">
    {tip id="127"}<a  nohref
            style="opacity:0;position:absolute;top:85px;left:120px;width:20px;height:15px"></a>{/tip}
    {tip id="128"}<a  href="##"
            style="opacity:0;position:absolute;top:206px;left:142px;width:20px;height:15px"></a>{/tip}
    {tip id="129"}<a  href="##"
            style="opacity:0;position:absolute;top:175px;left:236px;width:20px;height:15px"></a>{/tip}
    {tip id="130"}<a  href="##"
            style="opacity:0;position:absolute;top:260px;left:269px;width:20px;height:15px"></a>{/tip}
    {tip id="131"}<a  href="##"
            style="opacity:0;position:absolute;top:208px;left:350px;width:20px;height:15px"></a>{/tip}
    </div>
    
    
Image with tooltips (result of above settings):

Notes: Tooltip contents have been provided via Joomla articles - they are referred to using jmootips parameter "id". Both above solutions require use of jmootips version 1.1.1 or higher.

Visitors

Today: 13
Yesterday: 49
This Week: 159
Last Week: 278
This Month: 62
Last Month: 1,815
0186333
United States 27.7% USA
Germany 23.3% Germany
Russia 4.2% Russia
France 3.2% France
Italy 2.7% Italy
Indonesia 2.4% Indonesia
Poland 2.0% Poland

Total:

205

countries

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.