Created
January 31, 2023 05:17
-
-
Save jack2jm/7123632839ed596f538c176cb6953e24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Load css/js | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/sweetalert2/5.3.8/sweetalert2.css"/> | |
| <script src="https://cdn.jsdelivr.net/sweetalert2/5.3.8/sweetalert2.js"></script> | |
| 2. Define function | |
| const showLoading = function() { | |
| swal({ | |
| title: '', | |
| text: '<b>Be patient.</b><br/>This might take a few moments to load chatbot questions.', | |
| allowEscapeKey: false, | |
| allowOutsideClick: false, | |
| //timer: 4500, | |
| onOpen: () => { | |
| swal.showLoading(); | |
| } | |
| }) | |
| }; | |
| function closeSwalWhilePageLoaded(){ | |
| setTimeout(() => { | |
| swal.close(); | |
| }, 500); | |
| } | |
| 3. Call show loading | |
| showLoading(); | |
| 4. Call function to close loading | |
| closeSwalWhilePageLoaded(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment