scania / corporate-ui

This repo will be archived in Q3 2021, please visit https://github.com/scania-digital-design-system
https://digitaldesign.scania.com/
25 stars 15 forks source link

Bug - Corporate UI JQuery is undefined when using CDN #538

Closed helloimela closed 4 years ago

helloimela commented 4 years ago

Describe the bug
When initated via CDN, CorporateUI.$ is undefined after DOM loaded. We need to know when CorporateUI.$ is ready to avoid error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a page with CDN accessing CorporateUI
  2. Use CorporateUI.$ to initiate some event for example CorporateUi.$('[data-toggle="tooltip"]').tooltip()
  3. See error CorporateUI.$ undefined

Expected behavior
Application is able to know when the jQuery is ready to be used.

Screenshots
If applicable, add screenshots to help explain your problem. image

Version of Corporate-ui
4.0.2, scania theme 1.0.1

Framework and version
If you use any specific framework please provide information

Desktop information:
Please complete the following information

helloimela commented 4 years ago

Solved in #543 Event available to know when bootstrap jquery is ready, the event called bsReady Example usage:

document.addEventListener('bsReady', function(event) {      
  CorporateUi.$('[data-toggle="tooltip"]').tooltip();
});