layui.define(['layer', 'form', 'element', 'table', 'jquery', 'laydate'], function (exports) { var layer = layui.layer, form = layui.form, element = layui.element, table = layui.table; /* ----- 侧边客服悬浮1 ---- */ var flag = 1; $('.kefu-left').click(function () { if (flag == 1) { $(".kefu-right").animate({ right: '0px' }, 300); $(this).animate({ right: '136px' }, 300); flag = 0; } else { $(".kefu-right").animate({ right: '-136px' }, 300); $(this).animate({ right: '0px' }, 300); flag = 1; } }); /* ----- 侧边客服悬浮2 ---- */ $(document).on("mouseenter", ".suspension .a", function () { var _this = $(this); var s = $(".suspension"); var isservice = _this.hasclass("a-service"); var isservicephone = _this.hasclass("a-service-phone"); var isqrcode = _this.hasclass("a-qrcode"); if (isservice) { s.find(".d-service").show().siblings(".d").hide(); } if (isservicephone) { s.find(".d-service-phone").show().siblings(".d").hide(); } if (isqrcode) { s.find(".d-qrcode").show().siblings(".d").hide(); } }); $(document).on("mouseleave", ".suspension, .suspension .a-top", function () { $(".suspension").find(".d").hide(); }); $(document).on("mouseenter", ".suspension .a-top", function () { $(".suspension").find(".d").hide(); }); $(document).on("click", ".suspension .a-top", function () { $("html,body").animate({ scrolltop: 0 }); }); $(window).scroll(function () { var st = $(document).scrolltop(); var $top = $(".suspension .a-top"); if (st > 400) { $top.css({ display: 'block' }); } else { if ($top.is(":visible")) { $top.hide(); } } }); });