A
A
Aleksandr2017-04-28 18:21:53
JavaScript
Aleksandr, 2017-04-28 18:21:53

Adding elements from json and then removing them?

You need to do something like a vertical running line, in which elements from JSON are dynamically added and after the element leaves the container, they are deleted.
Can you tell me how this can be implemented?
What I have: https://codepen.io/anon/pen/JNWMMb

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2017-04-28
@Sashjkeee

It is known how many maximum blocks are visible at the same time. Keep blocks in an array. Insert and remove them from the DOM - only those 2 blocks that are visible are present in the page at any time.
Can be done in JS, but the animation twitches .
But better option with CSS animation . Two animations are used here - entry into the frame, and exit. At the end of each animation, the transitionend event is fired . Upon completion of the entry, it is time to start the exit of yourself and the entry of the next one.

I
Ivan Vishnevsky, 2017-04-28
@forgetable

With js object and JSON.stringify(objectName).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question