前端样式完成

master
Lee-1203 2022-05-12 16:16:45 +08:00
parent b93d5646bb
commit 5ea8349003
2 changed files with 60 additions and 18 deletions

View File

@ -81,24 +81,23 @@ jQuery(function($){
$('.head .head-btn').removeClass('cur');
$('.head .nav').removeClass('active');
});
})
// 提示弹窗
function openTips(val,closeTime='1500',title,align){
$('.nav-bg').css('display','block');
$('.tips-box').css('display','block');
if(title==''){
$('.tips-box').find('span').css('margin-bottom',0);
}
$('.tips-box').css('text-align',align);
$('.tips-box').find('span').text(title);
$('.tips-box').find('p').text(val);
setTimeout(function() {
$('.nav-bg').css('display','none');
$('.tips-box').css('display','none');
$('.tips-box').css('text-align','left');
$('.tips-box').find('span').text('');
$('.tips-box').find('p').text('');
},closeTime)
function openTips(val,closeTime='1500',title,align){
$('.nav-bg').css('display','block');
$('.tips-box').css('display','block');
if(title==''){
$('.tips-box').find('span').css('margin-bottom',0);
}
$('.tips-box').css('text-align',align);
$('.tips-box').find('span').text(title);
$('.tips-box').find('p').text(val);
setTimeout(function() {
$('.nav-bg').css('display','none');
$('.tips-box').css('display','none');
$('.tips-box').css('text-align','left');
$('.tips-box').find('span').text('');
$('.tips-box').find('p').text('');
},closeTime)
}

View File

@ -79,7 +79,7 @@
<span>手机验证码</span>
<section>
<input type="text" name="uname" placeholder="">
<button class="code-btn">获取手机验证码</button>
<button class="code-btn" id="btnSendCode">获取手机验证码</button>
</section>
</li>
<li>
@ -114,4 +114,47 @@
<!-- 提示框 -->
<div class="tips-box"><span></span><p></p></div>
</body>
<script type="text/javascript">
var InterValObj; //timer变量控制时间
var count = 60; //间隔函数1秒执行
var curCount = 60;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
$('#btnSendCode').click(function(){
curCount = count;
// var dealType; //验证方式
// var uid=$("#uid").val();//用户uid
// if ($("#phone").attr("checked") == true) {
// dealType = "phone";
// }
// else {
// dealType = "email";
// }
// //产生验证码
// for (var i = 0; i < codeLength; i++) {
// code += parseInt(Math.random() * 9).toString();
// }
//设置button效果开始计时
$("#btnSendCode").attr("disabled", "true");
$("#btnSendCode").text(curCount + "秒后重新获取");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器1秒执行一次
});
//timer处理函数
function SetRemainTime() {
if (curCount == 1) {
window.clearInterval(InterValObj);//停止计时器
$("#btnSendCode").removeAttr("disabled");//启用按钮
$("#btnSendCode").text("重新发送验证码");
code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效
} else {
curCount--;
$("#btnSendCode").text(curCount + "秒后重新获取");
}
}
</script>
</html>