I get an error from jQuery 1.10.2, the latter, and I would know if anyone has any other solution for this problem.
My script creates several DIV blocks (named elements) from one model (element model), adds the current after the last and displays it with a blind effect.
Here is the code, but you can also check it online this link .
<div id="item_model" style="display: none;" class="item">MODEL</div> <button class="addBtn">Add 5 items</button> <script> $(".addBtn").click(function() { for( var i=0; i<5; i++ ) { </script>
The problem is the same: last and insertAfter ().
Logics:
- The first element displays well and its effect has occurred (or not, another error, but time is running out)
- During the animation of the effect, the element is replaced by an external one.
- The following elements are inserted from the DOM (event, if after () you should insert it into the DOM), so they are not on the page.
This behavior is a jQuery bug, but I need to overcome this problem.
The solutions I know are:
- Do not use any effect.
- Use a container and add ().
- Use the slow effect instead of the blind. (Thanks to A. Wolf)
- Add elements to the DOM and AFTER, show everything. (Thanks to A. Wolf)
Thank you all for your input.
source share