_website/home.js: Use DOMContentLoaded instead of window.onload.

This commit is contained in:
Qi Xiao 2018-11-06 23:34:04 +00:00
parent c2f3ba50dc
commit 047423420d

View File

@ -1,4 +1,4 @@
window.onload = function() {
document.addEventListener('DOMContentLoaded', function() {
var current = 0,
expanded = true;
expander = document.getElementById('demo-expander'),
@ -16,7 +16,7 @@ window.onload = function() {
if (current != null) {
switcherLinks[current].className = "";
}
var translate = -demoWrappers[0].offsetWidth * to;
var translate = -demoWrappers[0].offsetWidth * to;
demoContainer.className = instant ? "" : "animated-transition";
demoContainer.style.transform = "translateX(" + translate + "px)";
switcherLinks[to].className = "current";
@ -181,4 +181,4 @@ window.onload = function() {
}
}
});
};
});