Hi,
OK, so my CSS, relevant HTML and JS will follow but first, here’s the explanation.
In my webpage, when the user submits a form of textarea content, an ajax insertion is fired off to put the submitted data into the Db. Then, the specific DIV is populated with the success message.
That all works but what I also need is a time-delay to remove the ‘success message’ after say 5 seconds and also, to remove it gradually/smoothly. Currently, it removes suddenly, after about 10 seconds. No smoothness. no ease-in ease-out smoothness.
Why does it seem that the visibility (duration) of the message seems to match the sum of transition-duration and transition-delay?
What way should I change it so the message disappears smoothly after 5 seconds?
You maybe able to achieve this with CSS animation, but here I have used Javascript. The text is added and then a setTimeout is used to add a hide class to the element after 5000ms (5s).
Thanks RPG_Digital. I’ll study that because it still cuts the display (of that message) suddenly. I’ll look for any potential conflicts with other CSS though using opacity seems to do it. (On chrome at least).
CSS
$("#viewing-notes-saved-message").text('That viewing comment has been saved');
document.getElementById("viewing-notes-saved-message").style.opacity = 0;