'What is the proper way to fire two scripts: one that loads data and another that manipulates styling?
I'm running a website that dynamically loads a new headline at refresh using JavaScript. I should mention, my site is extremely tiny so I'm purposefully avoiding using jQuery or any other JS libraries.
First script loads a JSON file and randomly selects an entry into the HTML. Second script "attempts" to check if the document's length runs past the viewport, if it does, shrink the text and check again.
ajax.request("GET","file.json"); // works fine
preventScroll.resize(".headline"); // not so much
However, I can't get the second script to work reliably. I've tried loading both through window.onload, I've tried moving it from the HEAD tag to immediately before the end of the BODY tag.
How should I properly call these so they always work?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
