-1

I'm working in Wordpress with the Elementor block builder and I'm trying to have a .gif image switch sources to another .gif image. The OnClick event I have works perfectly fine via web, but not mobile. I've searched endlessly and have made sure another element is not blocking the touch event, added OnTouch, etc but to no avail.

<img src="https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1.gif"
onClick="this.src='https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1D.gif'">
isherwood
  • 52,576
  • 15
  • 105
  • 143

1 Answers1

-1

Change onClick to onclick:

<img src="https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1.gif"
onclick="this.src='https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1D.gif'">

I also recommend not using the onclick attribute and instead using addEventListener for these reasons.

document.getElementById("image").addEventListener("click", function() {
  this.src = "https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1D.gif";
});
<img src="https://lowlifeclothing.co/wp-content/uploads/2020/09/Loop1.gif" id="image">
luek baja
  • 1,249
  • 5
  • 17