Rich-text Reply

How can you make an inserted image fade out?

AlixB 10-26-16

How can you make an inserted image fade out?

I'm trying to introduce simple tooltips on site but when I insert the image it remains there for the whole page view. I'd like to amend the image so that it appears on page load and then fades out after 2-3 seconds - can anyone recomend the best way to do this without a lot of coding?

Thanks

Alix

Level 1

robertchan 10-26-16
 

Re: How can you make an inserted image fade out?

Assuming you have jQuery on your website, you can do a timeout with a fadeout on your image. Below is an example, the only thing you'd need to modify is the selector to whatever your image is:

 

//3 second fadeout. Change 3000 to 2000 for a 2 second.

setTimeout(function() {
   $('#YOUR-IMAGE').fadeOut();
}, 3000 );

Use # if your image selector is an ID, and . if your image selector is a class.

Robert Chan

Experimentation Hero