The interface is used to hide the global loading box.
Use hideLoading interface
AlipayJSBridge.call('hideLoading');
Code sample
Show/hide global loading box:
<h1>Click the buttons below to see the different effects</h1>
<p>Note that the entire page will be covered after loading is displayed on Android system. So, please use the return key to turn off the loading.</p>
<button class="btn show">Display loading</button>
<button class="btn delay">Delay the loading display by 2 seconds</button>
<button class="btn notext">Loading without text</button>
<script>
function ready(callback) {
// Call directly if JSBridge has been injected
if (window.AlipayJSBridge) {
callback && callback();
} else {
// Monitor the injected events if JSBridge hasn't been injected
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
ready(function() {
document.querySelector('.show').addEventListener('click', function() {
AlipayJSBridge.call('showLoading', {
text: 'Loading',
});
setTimeout(function() {
AlipayJSBridge.call('hideLoading');
}, 3000);
});
document.querySelector('.delay').addEventListener('click', function() {
AlipayJSBridge.call('showLoading', {
text: 'Loading',
delay: 2000,
});
setTimeout(function() {
AlipayJSBridge.call('hideLoading');
}, 5000);
});
document.querySelector('.notext').addEventListener('click', function() {
AlipayJSBridge.call('showLoading', {
text: ' ',
});
setTimeout(function() {
AlipayJSBridge.call('hideLoading');
}, 3000);
});
});
</script>