$(function (){ var gourl = document.URL; $('input[name=gourl]').val(gourl); // 世界地图 $(".coordinate-item").hover(function(){ $(this).find(".city-name").stop().animate({bottom:'40px',opacity:'0'},260,function(){ $(this).hide(); }); $(this).find(".warehouse-detail").show().stop().animate({bottom:'26px',opacity:'1'},200); },function(){ $(this).find(".warehouse-detail").stop().animate({bottom:'50px',opacity:'0'},200,function(){ $(this).hide(); }); $(this).find(".city-name").show().stop().animate({bottom:'26px',opacity:'1'},260); }); $(".coordinate-item").hover(function(){ $(this).find(".warehouse_dright").show().stop().animate({left:'22px',opacity:'1'},200); },function(){ $(this).find(".warehouse_dright").stop().animate({left:'50px',opacity:'0'},200,function(){ $(this).hide(); }); }); $(window).scroll(function () { if($(window).width() > 768) { $(this).scrollTop() > 50 ? $("#back-to-top").fadeIn() : $("#back-to-top").fadeOut(); } }); $("#back-to-top").click(function () { return ( $("#back-to-top").hide(), $("body,html").animate({ scrollTop: 0 }, 800), !1 ); }); }) function checkGb() { var yourname = $('#theForm #contact_name'); var country = $('#theForm #contact_country'); var phone = $('#theForm #contact_tel'); var email = $('#theForm #contact_email'); var message = $('#theForm #contact_content'); if (yourname.val() == '') { layer.msg('请输入您的姓名.', { time: 1500 }); yourname.focus(); return false; } if (country.val() == '') { layer.msg('请输入您的国家/地区.', { time: 1500 }); country.focus(); return false; } if (phone.val() == '') { layer.msg('请输入您的电话号码.', { time: 1500 }); phone.focus(); return false; } if (email.val() == '') { layer.msg('请输入您的电子邮件地址.', { time: 1500 }); email.focus(); return false; } if (!/^([a-zA-Z0-9\._-])+@([a-zA-Z0-9_-])+(\.\S+)$/.test(email.val())) { layer.msg('请输入有效的电子邮件地址.', { time: 1500 }); email.focus(); return false; } if (message.val() == '') { layer.msg('请输入您的需求.', { time: 1500 }); message.focus(); return false; } $('#contact_submit').attr('disabled', true); $.ajax({ // async:false, url: "/home/guestbook/add.html", data: $('#theForm').serialize(), type: 'post', dataType: 'json', success: function (res) { layer.closeAll(); if (res.code == 0) { layer.msg(response.msg, { time: 1500 }, function () { window.location.reload(); }); } else if (res.code == 1) { window.location = '/home/guestbook/success_ok.html'; } else { $('#contact_submit').attr('disabled', false); layer.msg('留言失败!', { time: 2000 }); } }, error: function () { $('#tsend').attr('disabled', false); layer.closeAll(); layer.alert('留言失败!', { icon: 5 }); } }); }; function checkGb2() { var yourname = $('#theForm2 #side_contact_name'); var country = $('#theForm2 #side_contact_country'); var phone = $('#theForm2 #side_contact_tel'); var email = $('#theForm2 #side_contact_email'); var message = $('#theForm2 #side_contact_content'); if (yourname.val() == '') { layer.msg('请输入您的姓名.', { time: 1500 }); yourname.focus(); return false; } if (country.val() == '') { layer.msg('请输入您的国家/地区.', { time: 1500 }); country.focus(); return false; } if (phone.val() == '') { layer.msg('请输入您的电话号码.', { time: 1500 }); phone.focus(); return false; } if (email.val() == '') { layer.msg('请输入您的电子邮件地址.', { time: 1500 }); email.focus(); return false; } if (!/^([a-zA-Z0-9\._-])+@([a-zA-Z0-9_-])+(\.\S+)$/.test(email.val())) { layer.msg('请输入有效的电子邮件地址.', { time: 1500 }); email.focus(); return false; } if (message.val() == '') { layer.msg('请输入您的需求.', { time: 1500 }); message.focus(); return false; } $('#contact_submit').attr('disabled', true); $.ajax({ // async:false, url: "/home/guestbook/add.html", data: $('#theForm2').serialize(), type: 'post', dataType: 'json', success: function (res) { layer.closeAll(); if (res.code == 0) { layer.msg(response.msg, { time: 1500 }, function () { window.location.reload(); }); } else if (res.code == 1) { window.location = '/home/guestbook/success_ok.html'; } else { $('#contact_submit').attr('disabled', false); layer.msg('留言失败!', { time: 2000 }); } }, error: function () { $('#tsend').attr('disabled', false); layer.closeAll(); layer.alert('留言失败!', { icon: 5 }); } }); };