If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

activate hyperlink after holding down mouse for 3 seconds in a image map

hi everyone,

firstly to call myself a noob would be inflating my ego. I have done one project in javascript so far and have had no schooling on the topic, however I have learned quite a lot in the last few months from this thing called the 'internet'. So far I managed to make an html image map that has various tooltips which will appear onmouseover, and the tooltip disappears onmouseout. Each point of coords that i have defined has a hyperlink to a different page on the internet. It works just like i wanted it to and i couldn't be happier, that is, when i'm using a mouse...

When i am using a touchscreen device it is a different story. specifically i'm trying to port my html page to android as i figured it would be easy with the android sdk and webview (it was, but read on). What i found when i used the 'app' on my phone was that onmouseover works when you touch the screen, however it also registers as a click, so pop goes the tooltip, and i'm whisked away to my webpage. not the desired result.

Ideally I would like to hold down the screen for 3 seconds and then the hyperlink would activate, but i decided that just getting the thing functional would suffice for the time beaing so i tried to include some 'ondblclick' that would trigger a document.location. This worked fine on a web browser again, but had no result on the touchscreen. I decided to abandon this half step because I have read that ondblclick doesn't work in an image map and it isn't my intended result anyway.

I have found a lot of javascript and jquery samples that emulate the onHold event that i'm trying to achieve, both on this forum and all over the internet, however these samples are overly complex and are focused on looping an action, such as incrementally increasing a value or zooming or whatever. I just want to redirect the user to another page if they trigger 'onmousedown' for 3 seconds.

Users who have thanked RandomUser531 for this post:

thanks, Phil, but like my other attempts, I can't seem to get this to work within an image map. for example, one of my points on my map is pasted below. If i click on that point i am immediately forwarded to mozilla, even after adding the java script logic you included above

anyway, through a browser this works great. easy cut and paste job and works with my original html pages ( sans the doubleclick javascript nonsense). Unfortunately the new code seems to have no effect within the android webview. Maybe there is some deficiency in the android sdk that has made this not work up until now.

Yes. I have some javascript that displays tooltips when you hover over a point and that works ok. My guess is that holding down on the touchscreen does not register as a click, like a tap does. Some other gesture probably takes over when the screen is held, like drag movement. Well, I think I'll try to tackle hthis problem in the android dev forums