ImageMapster: "target" attribute on areas not working with clickNavigate
Without ImageMapster, you can use target="_blank" to open a new window. ImageMapster interevenes and uses javascript to navigate. We need to simulate target options when navigating.
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Comments: 20 (4 by maintainers)
OK - problems with the file at github - don’t ask.
Thought I had figured out my error, pasted again - but got the same result.
New id is : 8478644
Solution:
Lord knows why github processed the file I sent up this way - I have asked.
Well, I have just checked gist - and it is there
https://gist.github.com/NKarasek/847864
OK - this is getting ridiculous - and probably I’m to blame but can’t see exactly how/why.
I’ve put the file in my own js directory for you which can be referenced via:
script type=“text/javascript” src=“http://www.tbkd.org/js/jquery.imagemapster_NZK.js”> /script>
edit the script tabs as before
Anyway - the .js file you will end up with has all four of my updates
I added comments at the top of the .js file - they should get you on track.
Sorry for the confusion - I’m still trying to figure out github.
Nick
For both examples, click the word (not the state) vermont. (Btw. if you have multiple areas grouped, you’ll need to either reproduce the target/href on each one, or use a cross reference of some kind).
For just simulating “_blank” in config: http://jsfiddle.net/jamietre/ynYmX/12/
This should be good enough for most situations, however,
window.opendoes not work exactly the same astarget="_blank"and might be more susceptible to ad blockers.A more complete way is to actually let the browser do it by creating and clicking a link. This uses a function to simulate a browser click I found here: http://stackoverflow.com/questions/1421584/how-can-i-simulate-a-click-to-an-anchor-tag
Example:
The fakeClick function: