$(document).ready(function () { /* ----- 侧边悬浮 ---- */ $(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(); } } }); }); // 下面的悬浮框 $(function(){ $(window).scroll(function(){ height = $(window).scrollTop(); if(height > 30){ $('.wraper-1vdHN1Z2BV').fadeIn(300); }else{ $('.wraper-1vdHN1Z2BV').fadeOut(100); } }) }); // 百度商桥 $(function(){ // 点击按钮时判断 百度商桥代码中的“我要咨询”按钮的元素是否存在,存在的话就执行一次点击事件 $(".a-service").click(function(event) { if ($('#nb_invite_ok').length > 0) { $('#nb_invite_ok').click(); } }); });