Merge pull request #92 from hyrious/master
允许 `autoSpacing` 在 DOM ready 后调用
This commit is contained in:
commit
8fab6851db
1 changed files with 4 additions and 2 deletions
|
@ -118,13 +118,15 @@ class Heti {
|
||||||
}
|
}
|
||||||
|
|
||||||
autoSpacing () {
|
autoSpacing () {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
const callback = () => {
|
||||||
const $$rootList = document.querySelectorAll(this.rootSelector)
|
const $$rootList = document.querySelectorAll(this.rootSelector)
|
||||||
|
|
||||||
for (let $$root of $$rootList) {
|
for (let $$root of $$rootList) {
|
||||||
this.spacingElement($$root)
|
this.spacingElement($$root)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
if (document.readyState === 'complete') setTimeout(callback)
|
||||||
|
else document.addEventListener('DOMContentLoaded', callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue