$(function () { var win_w = $(window).width(); var win_h = $(window).height(); // 页面打开时,联系我们默认弹框倒计时 var objNo = $('.J-toobar-countdown'); var objTime = objNo.attr('data-time'); var objInterval = setInterval(function () { objTime--; objNo.text(objTime); if (objTime == 0) { clearInterval(objInterval); objNo.parents('.help').fadeOut(); } }, 1000) // 页面初始化时,判断之前是否点击过提示弹框,如果点击了就不在现在提示弹框 var closeHelp = setTimeout(function () { clearTimeout(closeHelp); if ($.cookie('layout-toobar') == null && $.cookie('layout-toobar') != "close-help" && win_w >= 1200) { $('.layout-toobar .more-contacts .help').show(); } }, 30000); // 页面打开时,快速关闭提示弹框 $('.J-contact-us-close').on('click', function () { $(this).parents('.help').fadeOut(); $.cookie('layout-toobar', "close-help", { expires: 30, path: '/' }); }) // 针对华为手机处理定位问题 if (baseLib.browserVersion() == 'huawei' && win_w < 750) { $('.layout-toobar .more-contacts').css('bottom', 115); } // 点击联系我们,弹出层显示 $('.J-contact-us').on('click', function () { $('.J-pop-up-layer').fadeIn(); $("body").addClass("overflowByContactUs") $('.layout-toobar .more-contacts .help').hide(); // 计算ul的高度 var setUlHeight = 0; $('.layout-toobar .clearflaot ul').each(function () { if ($(this).height() > setUlHeight) { setUlHeight = $(this).height(); } }) $('.layout-toobar .clearflaot ul').height(setUlHeight); }) // 点击弹框上的关闭按钮,关闭弹框 $('.J-close-btn,.J-pop-up-layer').on('click', function () { $('.J-pop-up-layer').fadeOut(); $("body").removeClass("overflowByContactUs") }) // 取消事件冒泡 $('.J-pop-up-layer .con').on('click', function (e) { e.stopPropagation(); }) // 当页面滚动到底部时,文字隐藏只显示图标(原因是按钮长度不一致,导致在部分小屏下遮住了分享按钮) 202111181422 $(window).scroll(function () { win_w = $(window).width(); if (win_w > 1200) { var t = $(window).scrollTop(); var docH = $(document).height(); win_h = $(window).height(); if (t > (docH - win_h - win_h / 2)) { $('.layout-toobar').addClass('min-icon'); } else { $('.layout-toobar').removeClass('min-icon'); } } }) // CONSENTMGR //同意记录 var tealiumGDPRecModal = $("#__tealiumGDPRecModal") function consentmgr() { if ($(window).width() < 1200) { return false } var isCookie = $.cookie("CONSENTMGR") if ( (isCookie != null) && (isCookie.indexOf("consent") != -1)) { $("body").removeClass("privacy") } else { if (tealiumGDPRecModal.length) { $("body").addClass("privacy") } } } setTimeout(consentmgr) if (tealiumGDPRecModal.length && tealiumGDPRecModal.is(":visible")) { $("body").on("click", "#privacy_pref_optin", function () { consentmgr() }) } })