window.onload = function(){ //缩放屏幕,改变overflow function throttle(method, context) { clearTimeout(method.tId); method.tId = setTimeout(function () { method.call(context); }, 100); }; cgMethod(); function cgMethod() { //console.log($(window).width(),window.screen.width - scrollWidth) if($(window).width() >= window.screen.width - scrollWidth - 40){ $('body').css({ 'overflowX':'hidden' }) }else{ $('body').css({ 'overflowX': 'auto' }) } }; window.onresize = function () { throttle(cgMethod, window) }; //导航默认样式 var oNavLi = $('.nav01 .level01>li'); var cg_mark = $('.sideBarBlock .hotTitle span').attr('firstCatId'); if($('#devide_homePage').length > 0){ //首页 oNavLi.eq(0).addClass('current'); }else{ //二级页面 oNavLi.each(function(index,ele){ if($(ele).find('.navCon').attr('catId') == cg_mark){ $(ele).addClass('current'); } }); $('body').css({ background: '#fff' }) } //组件title去掉'-' $('.wdzyTitle .title').each(function(index,ele){ var str = $(ele).html(); var startNum = str.indexOf('-'); if(startNum!=-1){ $(ele).html(str.slice(0,startNum)); } }); ;(function(){ // $(".zndy_fixed").hover(function(){ // $(this).find("img").attr('src','/images/v1.0/fixed_hover.png'); // },function(){ // $(this).find("img").attr('src','/images/v1.0/fixed.png'); // }); // $(".zndy_fixed .close").click(function(){ // $(this).parent().remove(); // }); // $(".zndy_fixed").click(function(){ // var url = "https://flbook.com.cn/c/n8KyC37MN7"; // window.open(url); // }); })(); /* ----- 侧边悬浮 -cpp--- */ $(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(); } } }); };