F
F
freshik3122018-01-30 18:01:24
JavaScript
freshik312, 2018-01-30 18:01:24

How to dynamically add and remove blocks?

I want to make the appearance of 3 blocks in turn and the 4th block appears, the 1st block disappears, i.e. so that the user always sees only 3 blocks. And display random information from the database in them. Tell me how to implement, because nothing intelligible comes out ...

what is now:

$('document').ready(function () {
        setTimeout(function () {
            setInterval(function () {
                $('.pay_ways').append('<div class="pay_block"><div>');
            }, 2000);
            setInterval(function () {
                $('.pay_block:last-child').detach();
            }, 4000);
        }, 2000);
    })

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-01-30
@freshik312

https://jsfiddle.net/zojv7j0c/

M
Maxim Timofeev, 2018-01-30
@webinar

api.jquery.com/queue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question