custom.js
... ...
@@ -1,4 +1,14 @@
1
-document.onload = (function() {
1
+function docReady(fn) {
2
+ // see if DOM is already available
3
+ if (document.readyState === "complete" || document.readyState === "interactive") {
4
+ // call on next available tick
5
+ setTimeout(fn, 1);
6
+ } else {
7
+ document.addEventListener("DOMContentLoaded", fn);
8
+ }
9
+}
10
+
11
+docReady(function() {
2 12
var sign_up_form = document.getElementById("tea-leaves-sign-up-form");
3 13
4 14
if(sign_up_form) {