/*--导航menu--*/ /* $(function () { $(window).scroll(function () { if ($(window).scrollTop() >= 1) { $(".nav_xiala_xx").addClass("fixedNav"); } else { $(".nav_xiala_xx").removeClass("fixedNav"); } }); }); */ /* 搜索 */ $('.lh-search-btn').click(function(){ if($('body').hasClass('Search')){ $('body').removeClass('Search'); }else{ $('body').addClass('Search'); } }); /* 询盘信息 */ $(function () { $('#xunpanText').hover(function() { var xunpanText = $(this).data('tiptitle'); $('#xunpantip').css({ top: $(this).outerHeight(true) + -80 + 'px' }) $('#xunpantip').text(xunpanText) $('#xunpantip').addClass('xunpantextactive') }, function () { $('#xunpantip').removeClass('xunpantextactive') }) }) /* 导航 */ $('.nav_xiala_xx .w1200 li').hover(function() { $(this).children('.nav_erji').slideDown(); event.stopPropagation(); }, function() { $(this).children('.nav_erji').slideUp(150); event.stopPropagation(); }); $(function () { var w1 = $(window).width(); var l1 = $(".nav_xiala_xx .nav_erji").eq(0).parent().offset().left; $(".nav_xiala_xx .nav_erji").eq(0).css('left', -l1); var l2 = $(".nav_xiala_xx .nav_erji").eq(1).parent().offset().left; $(".nav_xiala_xx .nav_erji").eq(1).css('left', -l2); var l3 = $(".nav_xiala_xx .nav_erji").eq(2).parent().offset().left; $(".nav_xiala_xx .nav_erji").eq(2).css('left', -l3); $(".nav_xiala_xx .nav_erji").css('width', w1); event.stopPropagation(); }); $(".nav_xiala_xx .w1200 li").on("mouseover", function () { setTimeout(() => { $(this).find(".top").stop().css({ "transform": "translateY(0)", "transition-delay": ".2s" }) $(this).find(".bottom").stop().css({ "transform": "translateY(0)", "transition-delay": ".4s" }) }, 200) }) $(".nav_xiala_xx .w1200 li").on("mouseleave", function () { setTimeout(() => { $(this).find(".top").stop().css({ "transform": "translateY(20px)", "transition-delay": ".2s" }) $(this).find(".bottom").stop().css({ "transform": "translateY(20px)", "transition-delay": ".1s" }) }, 200) }) // 表单提交 $('#btn').on('click', function () { var content = $('#content').val(); var userName = $('#userName').val(); var userPhone = $('#userPhone').val(); var kcode = $('#codeText').val().trim(); // var kemail = $('.useremail').val(); var reg = /^((0\d{2,3}[-]?\d{7,8})|(1[35847]\d{9})|([48]00[-]?[016789]\d{2,3}[-]?\d{3,4}))$/; if (userName == "") { alert('姓名不能为空!') $("#userName").focus(); return false; } if (userPhone == "") { alert('号码不能为空!') $("#userPhone").focus(); return false; } if(!reg.test(userPhone)) { alert('号码填写有误!') $("#userPhone").focus(); return false; } if (content == "" || content.length < 10) { alert('留言内容必须大于10字!') $("#content").focus(); return false; } if (kcode == "") { alert('验证码不能为空') $("#codeText").focus(); return false; } $.post('/api/message.ashx?action=add', { "kcontent": '信息:' + content , "kuser": userName, "kphone": userPhone, "kcode": kcode }, function (res) { if (res == '1') { alert("留言提交成功"); $('#content').val(''); $('#userName').val(''); $('#userPhone').val(''); $('#codeText').val(''); }else { alert('留言提交失败') } }) }) //验证码刷新 $("#imgCode").click(function () { $(this)[0].src = '/api/message.ashx?action=code&' + Math.random() })