HTML MAP tag, lessons learned

This year the Friends of Silverbrook Cemetery is hosting a virtual tour instead of the regular annual walking around tour for the cemetery.  The tour guide is Mollie Watson from the Niles History Center.  I recreated what Mollie did in Google Slides on the website.  This included copying images, cutting and pasting text, while trying to keep the flow of the presentation.

One slide that I found challenging was the hyperlinked map.  When you click on a star marker, you go to a page related to that part of the cemetery.  Here is the JPG file from the Virtual Tour Map page.


The most important step I found was to size your image properly. The original image was 1112x906 pixels.  I uploaded the image into a Joomla media folder and used the JCE editor to resize the file until it looked good. The new size of the image was 653x529, which is about half.

I opened the image in Paint.  I clicked the Resize option under Home->Image.  I selected pixels and typed in 653 and 529.  Then I saved it to a new file and uploaded the new image in Joomla.

In the code view of the article, I have the following tag for image:

<img src="/site4/images/VirtualTour/MapWithStars5.jpg" alt="" usemap="#mapwithstars" width="653" height="529" style="width: 653px;">

The usemap option is the magic that makes this work.

Within the article (still in code mode) I create a MAP block in HTML with the name and ID "mapwithstars".

<map name="mapwithstars" id="mapwithstars"> 

Then I capture each star point on the map.  This is the line for point 6, the Chime Tower.

<area alt="Chime Tower" coords="376,417,434,464" shape="rect" href="/site4/chime-tower" target="_self" title="Chime Tower">

I chose rectangles for each shape.  The coords are in the format x1,y1,x2,y2 for a rectangle.  I found that the differences between x1 and x2 or y1 and y2 should be at least 40 pixels.  

Here I'm hovering above left of the Chime Tower.


I finished the page with some more text and hyperlinks.

One pitfall working with a large image is that the MAP tag is not very useful for mobile.  Any image that's over 400 pixels will get distorted on a cell phone screen.  Rather than doing something clever with events, I just put a table of contents below the image which can be clicked easily.

Here are some links that were useful for my education:

Bob's Tech Corner

"HTML MAP tag, lessons learned"

https://bobstech.rvnllc.com

Bob Nightingale, info@rvnllc.com

Created 30-OCT-2020

Comments

Popular posts from this blog

MyMaps to Spreadsheet, KML to CSV and back

GPS Test KML to CSV

vim my way