Skip to content

Commit

Permalink
Wait for DOM to full load before injecting Leopard in production.
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Mar 10, 2020
1 parent f19c167 commit 6e3f9c3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions public/static/embed-leopard.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ document.documentElement.style.setProperty(
"--leopardvh",
"".concat(leopardViewHeight, "px")
);
var leopardTargetElement = document.getElementById("leopardChatWindow");

if (leopardTargetElement) {
leopardTargetElement.innerHTML = leopardChatTemplate;
} else {
document.body.insertAdjacentHTML("afterbegin", leopardChatTemplate);
}
document.addEventListener('DOMContentLoaded', function () {
var leopardTargetElement = document.getElementById("leopardChatWindow");
if (leopardTargetElement) {
leopardTargetElement.innerHTML = leopardChatTemplate;
} else {
document.body.insertAdjacentHTML("afterbegin", leopardChatTemplate);
}
});

var leopardAnimations = {
in: "flipInY",
Expand Down

0 comments on commit 6e3f9c3

Please sign in to comment.