• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1265
  • Last Modified:

Call Shadowbox or Javascript function from imagemap link

Hello experts,

I've been trying to show a modal window (shadowbox), using an imagemap instead of the <a> tag. Does anyone know how can I get it to work?

Or at least call a javascript function when clicking on an image map area?

Thank you very much,
Mircea
0
mircea_a
Asked:
mircea_a
  • 2
  • 2
1 Solution
 
mircea_aAuthor Commented:
By the way by shadowbox I mean shadowbox.js

Thanks again,
Mircea
0
 
Michel PlungjanIT ExpertCommented:
<area onClick="someJSFunction(); return false" ...

or for old browsers

<area href="void(someJSFunction())" ...
 
0
 
jeff9661Commented:
I have the same issue. I had someone write the attached Javascript which works great by assigning the class to the <a> tag. However I don't know how to tie this script / class  into your example above. I don't have to have both class options. I'm currently using the bottom one '560x470'

This is how I use it with a standard HREF:
<a href="popUpStyles/harmonyElite.html" class="560x470">Harmony Elite</a>

This is my image map code:
 <area  shape="poly" coords="65,160,110,135,111,33,155,15,150,6,67,37" href="popUpStyles/harmonyElite.html" alt="Harmony Elite" />




<script type="text/javascript">
	$(document).ready(function(){
		$('a.500x415').openDOMWindow({ 
			width:508,
			height:423,
			positionType:'centered', 
			eventType:'click', 
			windowSource:'iframe',
			windowPadding:0
		});
		
		$('a.560x470').openDOMWindow({ 
			width:568,
			height:478,
			positionType:'centered', 
			eventType:'click', 
			windowSource:'iframe',
			windowPadding:0
		});
	});
</script>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
Did you try
$('area.500x415')

and

 <area  class="500x415" shape="poly" coords="65,160,110,135,111,33,155,15,150,6,67,37" href="popUpStyles/harmonyElite.html" alt="Harmony Elite" />

0
 
jeff9661Commented:
Yes, that did the trick. Thought it was something like that. Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now