yxxw-html/js/my-site.js

150 lines
4.3 KiB
JavaScript
Raw Normal View History

2022-05-09 17:38:38 +08:00
jQuery(function($){
// 加载动画
if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: -50,
mobile: true,
live: true
});
wow.init();
};
2022-05-11 09:17:11 +08:00
// 更改同意按钮选中状态
2022-05-09 17:38:38 +08:00
$('.agree>span').find('em').click(function() {
$(this).toggleClass('checked');
});
2022-05-11 09:17:11 +08:00
// 更改单选按钮选中状态
$('.radio-section>span').click(function() {
$('.radio-section>span').find('em').removeClass('checked');
2022-05-13 11:09:43 +08:00
$('.radio-section>span').find('input').attr('checked',false);
2022-05-11 09:17:11 +08:00
$(this).find('em').addClass('checked');
2022-05-13 11:09:43 +08:00
$(this).find('input').attr('checked',true);
2022-05-11 09:17:11 +08:00
});
// 提现跳转
$('.withdrawal-btn').click(function() {
2022-05-11 15:08:41 +08:00
window.location.href = "/withdrawal-page.html";
2022-05-11 09:17:11 +08:00
});
2022-05-11 17:45:44 +08:00
// 修改资料跳转
$('#edit-information').click(function() {
window.location.href = "/user-edit.html";
});
2022-05-09 17:38:38 +08:00
// 首页筛选展示更多
$('.screen .more-btn').click(function() {
if($(this).find('ins').html() == '更多'){
$('.screen .more-btn').find('ins').html('更多');
$(this).find('ins').html('收起');
$('.screen .more-btn').find('em').removeClass('rotate');
$(this).find('em').addClass('rotate');
$('.screen>li').find('section').removeClass('open');
$(this).parent().find('section').addClass('open');
}else{
$(this).find('ins').html('更多');
$(this).find('em').removeClass('rotate');
$(this).parent().find('section').removeClass('open');
}
});
// 二级导航切换
var pullNavSwiper = new Swiper('.pull-nav-swiper',{
slidesPerView: 'auto',
slidesPerGroup: 1,
slidesPerGroupAuto: true,
autoplay:false,
})
2022-05-12 14:57:58 +08:00
// 快捷菜单
$('.top-right .icon-arrow').click(function() {
$(this).toggleClass('cur');
$('.top-right .open-more').toggle();
});
2022-05-12 16:18:33 +08:00
// 获取验证码(注册)
if($('#btnSendCode').length > 0){
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秒执行一次
});
}
2022-05-12 14:57:58 +08:00
2022-05-12 16:18:33 +08:00
//timer处理函数
function SetRemainTime() {
if (curCount == 1) {
window.clearInterval(InterValObj);//停止计时器
$("#btnSendCode").removeAttr("disabled");//启用按钮
$("#btnSendCode").text("重新发送验证码");
code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效
} else {
curCount--;
$("#btnSendCode").text(curCount + "秒后重新获取");
}
}
2022-05-09 17:38:38 +08:00
// 手机导航按钮
$('.head .head-btn').click(function() {
if ($('.head .head-btn').attr('class') == 'head-btn cur') {
$('.head .head-btn').removeClass('cur');
$('.head .nav').removeClass('active');
$('.head .nav-bg').removeClass('active');
} else {
$('.head .head-btn').addClass('cur');
$('.head .nav').addClass('active');
$('.head .nav-bg').addClass('active');
$('.head .logo').addClass('active');
}
});
$('.head .nav-bg').click(function() {
$(this).removeClass('active');
$('.head .head-btn').removeClass('cur');
$('.head .nav').removeClass('active');
});
})
2022-05-12 15:01:56 +08:00
// 提示弹窗
2022-05-12 16:16:45 +08:00
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);
2022-05-12 15:01:56 +08:00
}
2022-05-12 16:16:45 +08:00
$('.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)
}