yxxw-html/js/my-site.js

150 lines
4.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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();
};
// 更改同意按钮选中状态
$('.agree>span').find('em').click(function() {
$(this).toggleClass('checked');
});
// 更改单选按钮选中状态
$('.radio-section>span').click(function() {
$('.radio-section>span').find('em').removeClass('checked');
$('.radio-section>span').find('input').attr('checked',false);
$(this).find('em').addClass('checked');
$(this).find('input').attr('checked',true);
});
// 提现跳转
$('.withdrawal-btn').click(function() {
window.location.href = "/withdrawal-page.html";
});
// 修改资料跳转
$('#edit-information').click(function() {
window.location.href = "/user-edit.html";
});
// 首页筛选展示更多
$('.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,
})
// 快捷菜单
$('.top-right .icon-arrow').click(function() {
$(this).toggleClass('cur');
$('.top-right .open-more').toggle();
});
// 获取验证码(注册)
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秒执行一次
});
}
//timer处理函数
function SetRemainTime() {
if (curCount == 1) {
window.clearInterval(InterValObj);//停止计时器
$("#btnSendCode").removeAttr("disabled");//启用按钮
$("#btnSendCode").text("重新发送验证码");
code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效
} else {
curCount--;
$("#btnSendCode").text(curCount + "秒后重新获取");
}
}
// 手机导航按钮
$('.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');
});
})
// 提示弹窗
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)
}