后,我想在页面加载 我这个尝试后隐藏微调:隐藏Spinner加载
$(document).ready(function() {
$('.loader')
.hide() // Hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
});
我有这个div:
<style>
.loader {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url("{{ asset('img/loading.gif') }}") 50% 50% no-repeat rgb(249,249,249);
}
</style>
<div class="loader"></div>
但没有结果。
嗨马丁。你能解释ajaxStart和ajaxStop功能吗?这段代码是否与特定的库或插件相关,或者您是否打算编写这些代码? –
从jQuery 1.9开始,jQuery全局Ajax事件的所有处理程序(包括使用'.ajaxStart()'方法添加的处理程序)必须附加到'document' - [** Docs **](https:// api .jquery.com/ajaxStart /) –