A
A
Artem Golomazov2016-02-06 13:57:01
css
Artem Golomazov, 2016-02-06 13:57:01

How to change css properties after a certain time using JS?

Good afternoon!
The issue is that there are two divs containing phone numbers

<div id="tel_free" style="display=block;">88007777777</div>
<div id="tel_city" style="display=none;">+74737777777</div>

after a certain time, say 2 seconds, you need to get this look:
<div id="tel_free" style="display=none;">88007777777</div>
<div id="tel_city" style="display=block;">+74737777777</div>

if possible then with animation in the form of fading would be ideal.
I figured out the change in the properties of the element, but I can’t figure out how to fasten the timer and the attenuation.
document.getElementById('tel_free').style.display='none'; document.getElementById('tel_city').style.display='block';

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tvolf, 2016-02-06
@tvolf

To work with a timer, look towards setTimeout() or setInterval()
javascript.ru/settimeout

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question