- Issue created by @justclint
- 🇮🇩Indonesia gausartsI am not sure, but perhaps your calling JS was too early in the script orders? Tried to make it depend on blazy/loadorblazy/compat?If anything fails, try a little magic of setTimeout(myfunction, 911);.
- 🇮🇩Indonesia gausartsJust in case an oversight, putting your code inside Drupal.behaviors.myFunction.attach {}should normally work.Another decent magic is dBlazy.ready(myfunction, 911);, similar tojQuery.().ready(myfunction, 911);for very rare situations:
 > The .ready() method offers a way to run JavaScript code as soon as the page's Document Object Model (DOM) becomes safe to manipulate.
- 🇺🇸United States justclintThanks @gausarts! Im adding the blazy/load dependency higher up in our theme to see if that remedies the problem. If I see this issue again Ill try the dBlazy.ready method. 
- 🇮🇩Indonesia gausartsGot it, thanks. Looking forward to hearing the intermittent fixed before closing this. 
- Status changed to Fixedabout 2 years ago 8:34am 23 September 2023
- 🇮🇩Indonesia gausartsIf #2 and #3 do not work, the last I could think of: // See blazy.load.js. dBlazy.once.removeSafely('b-root', 'body', document); Drupal.attachBehaviors(document.body);Minor housekeeping for 2.18. 
 Feel free to share your solutions.Thank you. 
- Automatically closed - issue fixed for 2 weeks with no activity. 
- Status changed to Fixedalmost 2 years ago 4:17pm 17 January 2024
- 🇺🇸United States justclint@gausarts, apologies for delayed reply. Its just taken a while to monitor and diagnose. Your recommendation about reattaching the behaviors did seem to reduce the issue by about 80-90%. Although it was still occurring, it did point us in the right direction and was able to track this back to this issue: https://www.drupal.org/project/drupal/issues/3105024 🐛 Drupal main javascript file can't be loaded with "defer" attribute after upgrade to 8.8.1 Fixed So just want to mention in case anyone comes across this. The is not a blazy issue. Ultimately applying this solved the problem: https://www.drupal.org/project/advagg/issues/3046173#comment-14078683 →