All Products
Search
Document Center

Hide the loading box

Last Updated: Feb 10, 2021

The interface is used to hide the loading box of title bar.

Use hideTitleLoading interface

 
  1. AlipayJSBridge.call('hideTitleLoading');

Code sample

Show/hide global loading box:

 
  1. <h1>Click the buttons below to check the effect</h1>
  2. <a href="javascript:void(0)" class="btn show">Display loading</a>
  3. <a href="javascript:void(0)" class="btn hide">Hide loading</a>
  4. <script>
  5. function ready(callback) {
  6. // Call directly if JSBridge has been injected
  7. if (window.AlipayJSBridge) {
  8. callback && callback();
  9. } else {
  10. // Monitor the injected events if JSBridge hasn't been injected
  11. document.addEventListener('AlipayJSBridgeReady', callback, false);
  12. }
  13. }
  14. ready(function() {
  15. document.querySelector('.show').addEventListener('click', function() {
  16. AlipayJSBridge.call('showTitleLoading');
  17. });
  18. document.querySelector('.hide').addEventListener('click', function() {
  19. AlipayJSBridge.call('hideTitleLoading');
  20. });
  21. });
  22. </script>