Change the content of onclick according to page size

Asked

Viewed 58 times

1

I’m doing a project that some images have tooltip, but it only appears with the click. The problem is that the mobile version is not cool, so I need to open a new page with the content of this tooltip. Is there any way to change onclick content according to page size?

Ex:

On the desktop would be:

<img src="img.jpg" onclick="abre o tooltip" />

And in mobile would be:

<img src="img.jpg" onclick="location.href='abre pagina'" />

1 answer

1

  • 1

    Marta, it is worth mentioning that this is only for "modern" browsers, IE10+ for example. Otherwise +1

  • I didn’t even know that, @Sergio. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.