-1
I have this code with JQuery
, He does this: With the loop
as long as it is < 5
he adds 5 li’s in my html
, and then it generates a size
random and adds in CSS
, but it doesn’t work, all of mine li’s are of the same value. No console.log(size)
, the values are generated correctly, but when I put in css
he is fixed.
$(function () {
for (let i = 0; i < 5; i++) {
const bg = $('.bg-animation');
bg.append('<li></li>')
const li = $('.bg-animation li')
const random = function (min, max) {
return Math.random() * (max - min) + min;
};
const size = Math.floor(random(200, 400));
li.css({
'width': size + 'px',
'height': size + 'px',
'bottom': '-' + size + 'px',
})
}
})
Show, gosh, I didn’t know it, even with the documentation I didn’t preserve attention, I just went out copying aoskoaks
– Max Fly