jQuery(function () { $(".imgBg").each(function (index, element) {$(this).css("background-image", "url(" + $(this).find("img").attr("src") + ")")}); // nav-lang $('.navRig > li:has( > .navRigCon)').addClass('dropdown'); $(".navRig > li").hover(function (e) { if ($(window).width() > 1200) { $(this).toggleClass('cur') $(this).children(".navRigCon").stop(true, false).fadeToggle(); e.preventDefault(); } }); $(".navRig > li.dropdown > a").click(function (e) { if ($(window).width() <= 1200) { if($(this).parent().hasClass('cur')){ $(this).parent().removeClass('cur') $(this).parent().children(".navRigCon").slideUp(150); }else{ $(".navRig > li.dropdown").removeClass('cur') $(".navRigCon").slideUp(150); $(this).parent().addClass('cur') $(this).parent().children(".navRigCon").slideDown(150); } $(".navBtn").removeClass("active"); $(".navBox").stop(true, false).slideUp(); $(".header").removeClass("nav-open") e.preventDefault(); } }); //nav-search $(".navRig li.navSearch span").click(function(){ $(".header").addClass("opened") $(".searchInput").focus(); }) $(".searchClose").click(function(){ $(this).parents(".header").removeClass("opened") $(".searchInput").val("") }) $(window).scroll(function(){ $(".header").removeClass("opened"); $(".searchInput").val("") }) //mobile-nav-open $(".navBtn").click(function(){ $(this).stop(true, false).toggleClass("active"); $(".navBox").stop(true, false).slideToggle(); $(".header").toggleClass("nav-open"); $(".navRig > li.dropdown").removeClass('cur'); $(".navRigCon").slideUp(); }) // nav-list // navList 涓€绾 navSecond 浜岀骇 $('.navList > li:has( > .navSecond)').addClass('dropdown'); // $(".navList > li").hover(function (e) { // if ($(window).width() > 1200) { // // $(this).toggleClass('cur') // // $(this).children(".navSecond").stop(false,true).slideToggle(); // if($(this).hasClass('cur')){ // $(this).removeClass('cur') // $(this).children(".navSecond").stop(false, true).slideUp(); // }else{ // $(".navList > li.dropdown").removeClass('cur') // $(".navSecond").slideUp(150); // $(this).addClass('cur') // $(this).children(".navSecond").stop(false, true).slideDown(); // } // e.preventDefault(); // } // }); $(".navList > li").hover(function (e) { if ($(window).width() > 1200) { $(this).addClass('cur') $(this).children(".navSecond").stop(false, true).slideDown(); e.preventDefault(); } },function(e){ if ($(window).width() > 1200) { $(this).removeClass('cur') $(this).children(".navSecond").stop(false, true).slideUp(); e.preventDefault(); } }); $(".nav-one").hover( function(){ $(this).children(".nav-two").stop(true,true).slideDown(200) },function(){ $(this).children(".nav-two").stop(true,true).slideUp(200) }) // 鍐嶆杩涘叆 $(".navList > li").removeClass("cur"); $(".navSecond").hide(); // 鎵嬫満绔偣鍑诲睍寮€ $(".navList > li.dropdown > a").click(function (e) { if ($(window).width() <= 1200) { if($(this).parent().hasClass('cur')){ $(this).parent().removeClass('cur') $(this).parent().children(".navSecond").slideUp(150); }else{ $(".navList > li.dropdown").removeClass('cur') $(".navSecond").slideUp(150); $(this).parent().addClass('cur') $(this).parent().children(".navSecond").slideDown(150); } e.preventDefault(); } }); $("#msg .onIco").click(function(e){ $(this).parent().toggleClass("active"); e.stopPropagation() }) $(".onInput").click(function(e){ e.stopPropagation() }) $(".onMsgClose").click(function(){ $(this).parents('li').removeClass("active"); }) $(document).on("click",'body',function(e){ $("#msg").removeClass("active"); }) $("#top").click(function(){ $('html , body').animate({scrollTop: 0},'slow'); }) // 浜у搧瑙嗛 $(".palyBtn").each(function(){ if($(this).attr("data-video-src") == ''){ $(this).hide(); } }) $(document).on("click",".palyBtn",function(){ var src = $(this).attr("data-video-src"); //console.log(src); var vHtml = '
' + '
' + '' + '' '
' '
'; $("body").append(vHtml).css("overflow","hidden"); }) $(document).on("click",".videoClose",function(){ $(".videoBg").remove(); $("body").css("overflow","auto"); }) $("#resetBtn").on("click",function() { $(".text_count").html('0'); }) if(is_weixn()){ $(".ftAddress").hide(); $("#mobAddress").show(); $(".pcAdd").hide(); $(".mobAdd").show(); }else{ $(".ftAddress").show(); $("#mobAddress").hide(); $(".pcAdd").show(); $(".mobAdd").hide(); } }) // 鎻愪氦鐣欒█ // $(".onBtn").click(function(){ // var name = $("#onName"), // company = $("#onCompany"), // phone = $("#onPhone"), // text = $("#onContent"); // checkForm(name,company,phone,text); // }) function checkForm(name,company,phone,content){ if( name.val() == ''){ alert("璇疯緭鍏ユ偍鐨勫鍚?) name.focus(); return; } if( company.val() == ''){ alert("璇疯緭鍏ユ偍鐨勫叕鍙稿悕绉?) company.focus(); return; } if( phone.val() == '' || !(聽/^[1][3,4,5,7,8,9][0-9]{9}$/.test(phone.val())) || phone.val().length < 7 ){ //if( phone.val() == ''){ alert("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜1") phone.focus(); return; } if( content.val() == ''){ alert("璇疯緭鍏ユ偍鐨勬剰瑙佷笌寤鸿") return; } alert('鎻愪氦鎴愬姛') } function move(id,child){ var oUl = document.getElementById(id), l = oUl.offsetWidth / 2, t = oUl.offsetHeight / 2, aLi = $(oUl).find(child); oUl.onmousemove = function (ev) { var oEv = ev || event, iL = oEv.clientX, iT = oEv.clientY; for (var i = 0; i < aLi.length; i++) { if(i%2 == 1){ aLi[i].style.marginLeft = (iL - l) / 100 * aLi[i].style.zIndex + 'px'; aLi[i].style.marginTop = (iT - t) / 70 * aLi[i].style.zIndex + 'px'; }else{ aLi[i].style.marginLeft = -(iL - l) / 100 * aLi[i].style.zIndex + 'px'; aLi[i].style.marginTop = -(iT - t) / 70 * aLi[i].style.zIndex + 'px'; } } } } function wordLeg(obj,lll=1) { var currleg = $(obj).val().length; var length = $(obj).attr('maxlength'); console.log($(obj)[0].tagName == 'TEXTAREA') console.log(currleg, length) if (currleg >= length) { if(lll==2){ layer.msg('Please enter the number of words ' + length + ' within'); }else{ layer.msg('瀛楁暟璇峰湪' + length + '瀛椾互鍐?); } $(obj)[0].tagName == 'TEXTAREA' && $(obj).next('.word').find('.text_count').text(currleg); } else { // $('.text_count').text(currleg); $(obj)[0].tagName == 'TEXTAREA' && $(obj).next('.word').find('.text_count').text(currleg); } } function is_weixn(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { return true; } else { return false; } }