Когда я использую console.log(jara.children);
, консоль показывает:
HTMLCollection []
0: div#jarallax-container-2
length: 1
jarallax-container-2: div#jarallax-container-2
__proto__: HTMLCollection
Показывает длину: 1. Однако, когда я использую console.log(jara.children.length);
для печати длины коллекции, все это показывает 0
.Это немного странно, я не совсем знаком с HTML, может кто-нибудь объяснить?
Редактировать:
var jaras = [].slice.call(document.querySelectorAll("div.jarallax"));
console.log(jaras);
jaras.forEach(function (jara) {
console.log(jara.children.length);
});
Поскольку я использую https://github.com/nk-o/jarallax этот пакет дляпараллакс-прокрутка, DOM показан ниже:
![enter image description here](https://i.stack.imgur.com/GgEFJ.png)