$(function () { var wow = new WOW({ offset: 0, mobile: false, }); wow.init(); $(".qinlin-nav") .find(".sc") .hover( function () { $(this).find("form").show(); }, function () { $(this).find("form").hide(); } ); $(".dropdown").hover( function () { $(this).addClass("open"); }, function () { $(this).removeClass("open"); } ); $(".hform") .find("form") .submit(function () { if (!$(this).find('[name="key"]').val()) { alert("内容不能为空"); return false; } }); $(".qinlin-nav") .find("form") .submit(function () { if (!$(this).find('[name="key"]').val()) { alert("内容不能为空"); return false; } }); // 右侧滑动返回顶部 var time; var $kefu = $(".kefu"); var $c = $kefu.find("#kefu"); $kefu.css({ marginTop: -($kefu.height() / 2), }); $c.find("li").on({ mouseenter: function () { var scope = this; time = setTimeout(function () { var divDom = $(scope).children("div"); var maxWidth = divDom.width(); $(scope) .stop() .animate({ left: 77 - maxWidth, }, "normal", function () { var pic = $(scope).find(".kefu-weixin-pic"); if (pic.length > 0) { pic.show(); } } ); }, 100); }, mouseleave: function () { var pic = $(this).find(".kefu-weixin-pic"); if (pic.length > 0) { pic.hide(); } clearTimeout(time); $(this) .stop() .animate({ left: 0, }, "normal", function () {} ); }, }); $(window).scroll(function () { var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; var eltop = $c.find(".kefu-ftop"); if (scrollTop > 0) { eltop.show(); } else { eltop.hide(); } }); $c.find(".kefu-ftop").click(function () { var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (scrollTop > 0) { $("html,body").animate({ scrollTop: 0, }, "slow" ); } }); });