I’m expecting the top paragraph to fade out as the bottom paragraph fades in but the element is getting removed from the DOM before the animation happens.
When there are 5 paragraphs in the collection (querySelectorAll) the 0 index gets removed. The CSS animation works as expected for createElement not for .remove()
What am I missing?
function addPara() {
let r = Math.floor(Math.random() * 9);
let g = Math.floor(Math.random() * 9);
let b = Math.floor(Math.random() * 9);
let bg = `#${r}${g}${b}`
let qsaPara = document.querySelectorAll('p');
const para = document.createElement('p')
para.style.backgroundColor = bg
para.style.height = '3rem'
document.body.appendChild(para)
let paraArray = Array.from(qsaPara);
let l = paraArray.length
let clVal = para.classList.value;
function parRemove() {
paraArray[0].remove();
paraArray[0].removeEventListener('transitionend', parRemove)
}
if (paraArray.length >= 5) {
paraArray[0].classList.add('fall');
// para.innerHTML += `class:${clVal}`
paraArray.forEach((para, i) => {
para.nextSibling.innerHTML = `index ${i}, collection length${l}, class:${clVal}`;
});
//------------------------
paraArray[0].addEventListener('transitionend', parRemove, false);
//----------------------
} else if (paraArray.length <= 5) {
paraArray.forEach((para, i) => {
para.innerHTML = `index ${i}, collection length${l}, class:${clVal}`
})
}
}
const paraTimer = setInterval(addPara, 2000);
p {
color: white;
width: 100%;
animation-name: fade-in;
animation-duration: 1s;
animation-iteration-count: 1;
transition: all ease-in-out 1s;
}
.fade {
animation-name: fade-out;
animation-duration: 1s;
animation-iteration-count: 1;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
provigil for adhd – provigil settlement provigil cost
Admiring the time and effort you put into your website and
in depth information you offer. It’s good to come across a
blog every once in a while that isn’t the same out of date rehashed material.
Great read! I’ve bookmarked your site and I’m adding your RSS
feeds to my Google account. http://droga5.net/
accutane online singapore – accutane pharmacy accutane singapore
Your style is very unique in comparison to other people I have read stuff from.
Thanks for posting when you’ve got the opportunity, Guess I’ll just book mark this web site. http://herreramedical.org/azithromycin
amoxicillin no prescription – amoxil 500 mg walgreens amoxicillin price
I absolutely love your blog and find almost all of your post’s to be precisely what
I’m looking for. Does one offer guest writers to write content to
suit your needs? I wouldn’t mind publishing a post or elaborating on many of the subjects you write
concerning here. Again, awesome website! http://antiibioticsland.com/Bactrim.htm
online vardenafil – vardenafil online bestellen side effects of vardenafil
Hi, the whole thing is going perfectly here and ofcourse every one is
sharing facts, that’s genuinely fine, keep up writing. http://cleckleyfloors.com/
ivermectin 4 mg – ivermectin price canada ivermectin buy online
cialis usa pharmacy – cialis online usa cialis price in australia
ivermectin for humans walmart – ivermectin 400 mg brands is ivermectin a prescription drug
It’s truly very complicated in this active life to listen news on Television, therefore I just use world wide web for that
purpose, and obtain the hottest information. http://hydroxychloroquined.online/
can you buy accutane over the counter in canada – accutane 10mg buy accutane online australia
Thanks designed for sharing such a nice thought, paragraph is fastidious,
thats why i have read it entirely https://www.herpessymptomsinmen.org/where-to-buy-hydroxychloroquine/
lyrica 75 mg capsule price – ed drugs canadian pharmacy xanax
This post is invaluable. When can I find out more? https://herreramedical.org/hydroxychloroquine
buy amoxicilin 500 mg canada – buy amoxicilin noscript canada amoxicillin on line
sildenafil 120mg price – viagra 100mg tablets sildenafil in india online
legitimate online pharmacy uk – cialis usa price buy cialis in canada
ivermectin ebay – ivermectin medicine ivermectin 12mg
generic prednisone 10mg – prednisone deltasone 20 mg prednisone
buy modafinil online – provigil 200 mg provigil for adhd
azithromycin 500mg online – can you buy zithromax zithromax 100mg pills
lasix drug for sale – lasix for sale lasix dosage
clomid treats – bbclomid.com clomid online
how to buy cialis from canada – canadian online pharmacy tadalafil for sale uk
Howdy! Quick question that’s completely off topic.
Do you know how to make your site mobile friendly? My blog looks weird when viewing from my iphone 4.
I’m trying to find a theme or plugin that might be
able to correct this issue. If you have any suggestions, please share.
With thanks! http://www.deinformedvoters.org/hydroxychloroquine
best online generic tadalafil – Best prices on cialis canada generic tadalafil
stromectol buy uk – ivermectin tablets stromectol oral
what is the main cause of erectile dysfunction – ed doctor ed pills amazon
amoxicilina 500 mg – buy amoxicilina 500 mg buy amoxicilin 500 mg from canada
generic viagra mexico – Free viagra samples buy sildenafil uk online
purchase sildenafil – sildenafil sample sildenafil alternative
Thank you a lot for sharing this with all people you actually understand what you’re talking approximately!
Bookmarked. Please also visit my website =). We may have a link change contract between us http://ciaalis2u.com/
stromectol xl – can i buy ivermectin online stromectol ivermectin
rx amoxicillin
cheapest place to get propecia
vardenafil com – generic vardenafil erectile dysfunction remedies
Howdy, I think your blog may be having browser compatibility problems.
When I look at your site in Safari, it looks fine however when opening in I.E., it has some overlapping issues.
I simply wanted to provide you with a quick heads
up! Other than that, fantastic site! http://herreramedical.org/aurogra
orlistat moa – xenical pills for sale orlistat slimming pills
cheap cialis canada pharmacy
tadalafil generic where to buy
cialis pills order – 50mg cialis cialis without prescription canada
zithromax amazon
ivermectin 3mg tablets – stromectol uk ivermectin for cov 19
I am curious to find out what blog platform you’re using?
I’m having some small security issues with my latest website and I’d
like to find something more risk-free. Do you have any
suggestions? http://harmonyhomesltd.com/Ivermectinum-tablets.html
cialis original
tadalafil tablets 20 mg online
54899 prednisone – prednisone 60 mg pills prednisone 13 mg
azithromycin from canada – buy azithromycin over the counter usa zithromax 250 mg z-pak tablet
online casinos for usa players – no deposit casino casino slots gambling
accutane from canada – buy accutane online 30mg accutane cost without insurance
sildenafil citrate reddit generic viagra super active sildenafil 100mg
dissertation writing advice dissertation format
buy a paper online paper writers for college
cheap viagra uk viagra mastercard
cruel angel thesis piano version steven johnson games thesis
introduction in term paper example critical thinking term paper topics
sildalis ca – sildalis pills metformin tablet
fluconazole 200 mg cost
buy acillin pills – ciprofloxacin 1000mg over the counter plaquenil pills
cost viagra 100mg – goodrx cialis tadalafil 40mg tablet
amoxicillin 500mg to buy online
viagra 25mg generique en pharmacie – sildenafil 200mg ohne rezept cialis pas cher
albuterol inhaler cost
ivermectin 6mg online – ed pills ivermectin 0.08
purchase prednisone – prednisone 5mg sale buy prednisone 10mg sale
buy isotretinoin 40mg generic – buy amlodipine 5mg generic amoxil 500mg over the counter
amoxicillin uti infection
lyrica 150mg generic – lasix 100mg usa azithromycin online
cenforce sale – buy zovirax 400mg without prescription buy zovirax 800mg for sale
tizanidine 2mg generic – order colchicine generic colchicine over the counter
discount cialis cialis 20mg
viagra story discount viagra
cialis without a prescription cialis generic