Forked from jack2jm/Sweetalert loading center popup
Created
February 12, 2024 05:50
-
-
Save Bhavya8181/6ee7f937f914b34bcb829abd853f3dc2 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