0

I know how to create help text with a mouseover event.

However, this doesn't work when using a smart phone.

Is there a way to create a button that, when clicked, will display help text that looks the same as the mouseover help text?

  • Look here http://stackoverflow.com/questions/2851663/how-do-i-simulate-a-hover-with-a-touch-in-touch-enabled-browsers – spezzino Jan 14 '14 at 23:10
  • On mobile devices, there's no such thing as **hover.** I think you mean **active.** – Cilan Jan 14 '14 at 23:13

1 Answers1

2

hover doesn't exist on mobile devices, and I'm guessing you're meaning while the user touches the Element. If this is the case, I see you have two options:


1 (CSS) Use :active

Example:

Element:active{ /* Stuff to do */ }


2 (Javascript) Use ontouchstart

Element.ontouchstart = function(e)
{
    //hovering
};

or

Element.addEventListener('touchstart', function(e)
{
    //Hovering!
});

I'll leave you to the rest, because as you said: I know how to create help text with a mouseover event.

Cilan
  • 13,101
  • 3
  • 34
  • 51