$(function() { //lang语言选择 $('.lang').hover(function() { $(this).children('ul').slideDown() }, function() { $(this).children('ul').slideUp() }) //pc_nav导航下拉 $('.innerNav li').has('div').hover(function() { $(this).children('div').stop(true).slideDown() }, function() { $(this).children('div').slideUp() }) //Mbnav导航展开 $('.Mbmenu span').click(function() { $('.sideMneu').addClass('open'); }) $('.sideMneu h4 span').click(function() { $('.sideMneu').removeClass('open'); }) $('.proBox .next').click(function() { $('.proBox .swiper-button-next').click() }) $('.proBox .pre').click(function() { $('.proBox .swiper-button-prev').click() }) //Mbnav内页导航展开 $('#nMbanerbox .subMbMenu').click(function() { $('.menuFixed').addClass('open'); }) $('.MbCode .menuFixed .close').click(function() { $('.menuFixed').removeClass('open'); }) $('.MbCode .menuFixed nav li').has('div').click(function(){ $(this).siblings().children('a').find('i').removeClass('down'); $(this).siblings().children('.subhide').slideUp(300); $(this).children('a').find('i').toggleClass('down'); $(this).children('.subhide').stop().slideToggle(300); }) //下载万博manbetx官网app下载登录 $('.MbCode .pages li.center').click(function(){ $(this).find('.hide').slideToggle(300) }) //产品导航 $('.product aside .bar i').click(function() { $(this).children('.jia').toggle(0); $(this).children('.jian').toggle(0); $(this).parent().next().slideToggle(50); $(this).parent().parent().siblings().children('.navgtion').children('i').children('.jian').hide(); $(this).parent().parent().siblings().children('.navgtion').children('i').children('.jia').show(); $(this).parent().parent().siblings().children('.hide').slideUp(300); }) //下载 $('.chioceAll label').click(function(e) { var checkBox = $(this).prev().find('input'); if(checkBox.is(':checked')) { checkBox.prop("checked", false); console.log('不选中') $('.downLoadetail li input').each(function() { $(this).prop('checked', false) $(this).change() }) $(this).prev().children('.chok').hide(0); $(this).prev().children('.chno').show(0); } else { checkBox.prop("checked", true); console.log('选中') $('.downLoadetail li input').each(function() { $(this).prop('checked', true) $(this).change() }) $(this).prev().children('.chok').show(0); $(this).prev().children('.chno').hide(0); } }) $('.chioceAll a').click(function() { $('.downLoadetail li').each(function() { if($(this).find('input').is(':checked')) { $(this).find('a')[0].click(); } }) }) $('.downLoadetail li input').each(function() { $(this).change(function() { if($(this).is(':checked')) { $(this).parent().find('.chok').show(0); $(this).parent().find('.chno').hide(0); } else { $(this).parent().find('.chok').hide(0); $(this).parent().find('.chno').show(0); } }) }) $('.downLoadetail li label').click(function(e) { var checkBox = $(this).find('input'); if(checkBox.is(':checked')) { $(this).find('.chok').show(0); $(this).find('.chno').hide(0); } else { $(this).find('.chok').hide(0); $(this).find('.chno').show(0); } }) //表单验证 var telReg = /^1[3|4|5|7|8][0-9]{9}$/; var faxReg = /^(\d{3,4}-)?\d{7,8}$/; var emailReg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; $('form .tel').each(function() { $(this).blur(function() { if(!telReg.test($(this).val())) { $(this).parent().find('span').show() } else { $(this).parent().find('span').hide() } }) }) $('form .email').each(function() { $(this).blur(function() { if(!emailReg.test($(this).val())) { $(this).parent().find('span').show() } else { $(this).parent().find('span').hide() } }) }) $('form .sumit').click(function() { var requie = $(this).parents('form').find('.requie'); requie.each(function() { console.log($(this).val()) if($(this).val() == '' || $(this).val() == null) { $(this).parent().find('span').show() } else { $(this).parent().find('span').hide() } }) }) //函数节流 var throttle = function(fn, delay) { var timer = null; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function() { fn.apply(context, args); }, delay); }; }; //动画显示 function actionAnation() { var wh = $(window).height(); var ww = $(window).width(); if(ww > 900) { $(document).scroll(throttle(function() { var sh = $(this).scrollTop(); $('.anmation').each(function() { var top = $(this).offset().top; if(top - wh <= sh) { $(this).addClass('actShow') } }) }, 100)); $('.anmation').each(function() { var top = $(this).offset().top; if(top <= wh) { $(this).addClass('actShow') } }); } } actionAnation() $(window).resize(function() { actionAnation(); }) })