I have been stumbled on this for a while and after a few weeks of research I feel it safe to ask for help here.
What I am trying to do is this: User clicks an image> Light box displays larger image > Larger image has a hotspot with a link to another page.
Is this possible? It seems simple enough but I can’t seem to get it working. Here is the code for reference.
<a href="images/createaccount_img.jpg" rel="lightbox" usemap="#Map" map name="Map" id="Map"><area shape="rect" coords="323,205,567,361" href="URL LINK 1" target="_blank" /><area shape="rect" coords="995,613,1191,668" href="URL LINK 2" target="_blank" > <img src="images/panel_login_11.jpg" width="152" height="27" alt="" />
SOLUTION: the best option was to use http://fancybox.net/ which allows you to add many extra elements inside the box including: Divs, iframes, html and more! Thanks again everyone.
First of all: map is a separate tag. So your code would never have worked.
This is how you normally use a map:
That being said, I then figured to place a attribute
data-usemapon the link that contains the url to the full-size image. Like this:Then I modified
lightbox.jsto read this attributeusemap: $link.attr('data-usemap')and set that attribute$image.attr('usemap', _this.album[imageNumber].usemap);Now the full-size image has the correct usemap set.
But it still does not work!! I think this is because of div’s that overlay on this image.
Here is the fiddle I’ve worked on. Search for
//xxx addedto find the 2 lines I added. Maybe someone else could work on it some more.In other words, I don’t think it will be easy to create a mod over an unmodified lightbox.js.
A also want to note that a lot of scripts like lightbox also resize the full-size image to fit the screen (lightbox does not do this as far as I could see): THEN you would also need javascript to re-calculate the coordinates in the map(s) I guess.