Using animations for all javascript purposes

I have a project I'm working on that performs many dom html javascript functions, for example:

this.firstChild.nodeValue = "example"; document.getElementById('id').innerHTML = "example"; 

There are many of them, and not all of them are the same. I want every time I assign a value / output to html, it uses jquery animate "fade in."

Is it possible to do without completing each task and do it manually?

Thanks.

+5
source share
1 answer

Why don't you try using a function by passing arguments.

 function animate(value, dom){ dom.firstChild.nodeValue = value; document.getElementById('id').innerHTML = value; $(dom).fadeIn(); } 
0
source

Source: https://habr.com/ru/post/1209038/


All Articles