【发布时间】:2024-01-21 07:09:01
【问题描述】:
我有一个用户在他们的手机上填写的表格,在用户点击提交按钮后,我会弹出一个旋转轮,这样用户就不会再次点击提交按钮。
不幸的是,如果他们的手机信号较弱,则不会出现旋转轮,用户再次点击提交按钮。这会导致提交两个表单。
如果我在点击时隐藏按钮,我不会有相同的程序吗?真正的问题是,由于用户点击提交按钮时信号较弱,请求仍在处理中,对吧?还有哪些其他解决方案?
#divLoading
{
display : none;
}
#divLoading.show
{
display : block;
position : fixed;
z-index: 100;
background-image : url('spinner.gif');
background-color:#666;
opacity : 0.4;
background-repeat : no-repeat;
background-position : center;
left : 0;
bottom : 0;
right : 0;
top : 0;
}
<script>
$(document).ready(function(){
$("#saveandsubmitbutton").click(function(){
$("div#divLoading").addClass('show');
});
});
</script>
【问题讨论】:
-
预加载图片
spinner.gif
标签: javascript jquery