Image Map <area> tag ... Open Shadowbox from Onclick Event

5 messages Options
Embed this post
Permalink
build

Image Map <area> tag ... Open Shadowbox from Onclick Event

Reply Threaded More More options
Print post
Permalink
(This post was updated on )
G'day,
On occasion you may want to launch shadowbox from the onclick event in an image map <area> tag.

As posting code here is a %^&* I've put up an example here:
http://www.web.build.id.au/shadowbox/

the code also allows passing options like title, width, etc to shadowbox.

However I can't get the gallery option to work can you blokes and ladies help at all?

cheers 'n beers,
build
build

Re: Image Map <area> tag ... Open Shadowbox from Onclick Event

Reply Threaded More More options
Print post
Permalink
G'day All,
Sorry to kick this up but I still can't resolve it on my own.

Thanks in anticipation,
build
Wizzud

Re: Image Map <area> tag ... Open Shadowbox from Onclick Event

Reply Threaded More More options
Print post
Permalink
That's probably because there is no easy resolution.

You're trying to activate a gallery without letting Shadowbox know about that gallery's constituent parts until you want to display an item within that gallery as part of the entire gallery.

You need to find a way for a single click on one area element (of the gallery) to initiate a build of an array of Shadowbox-cache-like objects, each object completely representing an item of the associated gallery, then pass that array into Shadowbox.open()....
- pick a valid attribute - an alternative to rel - for use with the area tag
- use it to store your rel-equivalent string (per area tag)
- set onclick to point to a handler function passing this
- in the onclick handler
  - find all other constituents for the gallery
  - build a cache object, for each item of the gallery, including the clicked element, using the stuff from the alternate attribute (or a rel attribute if its a standard anchor within the same gallery?)
  - call open(), passing in the constructed array of cache objects

You still have a problem though. In a normal gallery, the clicked-on item appears in its rightful place in the order the gallery is presented in. When using open() with an array of cache objects, the initial presentation is the first item in the array. So, unless you arrange your cache objects such that the clicked-on element is first in the array regardless of its proper position in the gallery, the first item shown may not be the one clicked on. Trouble is, if you do rearrange the items so that the clicked-on one comes first, you are presenting the gallery in a different order each time a different item of the gallery is clicked on!

Another problem is mixing rel-attribute anchors with these area tags in the same gallery. With Shadowbox not knowing about the area elements, how do you get them to show up in a gallery initiated by a click on an anchor that Shadowbox does know about?

My suggestion : forget about onclick/Shadowbox.open(); just set up the elements as documented and let Shadowbox handling the clicking, you'll have less headaches!
Combine literacy with curiosity and a whole world of information opens up to you
Frensoa

Re: Image Map <area> tag ... Open Shadowbox from Onclick Event

Reply Threaded More More options
Print post
Permalink
In reply to this post by build
Sorry to put this thread back on the frontburner, but i've been trying to implement this feature on my website, following the same tutorial, and it still doesn't work.

Here's the page: http://www.libertedelafesse.org/europe.php   (the link is on France on the map :)

Could someone please help me?

I certify i've spent many hours trying to do it alone, this forum is my last option, otherwise i'll forget about implementing shadowbox with the area tag.

Thanks a lot everyone!
ravishsehgal

Re: Image Map <area> tag ... Open Shadowbox from Onclick Event

Reply Threaded More More options
Print post
Permalink
In reply to this post by build
Hi I saw your website and i need a code asap please if possible.
What i need is when a user click a button shadow window opens with a custom url.
and when the user click close shadowbox it closes it and the parent window gets refreshed.
looking for a quick reply any help will be deeply appreciated.

kind regards,
Ravish Sehgal