$(function() { $("#footer").load("https://data.chinahighlights.com/public/template/footer.html"); // 移动端首页增加展开收缩效果 $(".withMenu").each(function(index, element) { $withMenu = $(element); $withMenu.click(function () { $self = $(this); var targetId = $self.data("target"); var collapse = $self.data("collapse"); if (collapse == undefined || collapse == 0) { $self.children("a").text("x"); $self.data("collapse", "1"); $(targetId).show('fast'); } else { $(targetId).hide(); $self.children("a").text("+"); $self.data("collapse", "0"); } }); }); // 滚动变换导航 var nav_id = $('#header'); var html_body = $('html,body'); var new_nav_name = 'getFixed'; if (nav_id.length > 0) { $(window).on('scroll',function(){ var scrollTop = html_body.scrollTop(); if (scrollTop > 100 ) { nav_id.addClass(new_nav_name); }else{ nav_id.removeClass(new_nav_name); } }); } // 检测 IP 确定是否显示隐私提醒 var cookies = document.cookie.split(";"); var reminderDisplay = null; var cookieName = "__ch_privacy_reminder="; for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.indexOf(cookieName) === 0) { reminderDisplay = cookie.substring(cookieName.length, cookie.length); } } if (reminderDisplay === null) { $.get('https://www.chinahighlights.com/guide-use.php/apps/ip2location/index/is_eu_country', function(data, status, xhr) { if (data === "true") { $("#footer").load("/public/template/privacy-reminder.html"); } } ); } }); // phone number pop up $(".currentNo").click(function() { $(".freePhone").show(); }); $(".tollfree .freePhone .closeBlock").click(function() { $(".freePhone").hide(); });