$(document).ready(function() { // 导航 //搜索条 $('.li_search').mouseover(function(){ $('.li_search input').css({'opacity':'1'}); }); $('.li_search').mouseout(function(){ $('.li_search input').css({'opacity':'0'}); }); //搜索 $(".btn-search").on("click", function () { var keywords = $(".search-keywords").val(); if (keywords) { window.location.href = "/index.php?f=search&keywords=" + keywords; } }) //二级导航 $(".nav_item li.p_navItem1").hover(function () { $(this).find(".nav_con").slideDown(0); }, function () { $(this).find(".nav_con").slideUp(0); }) // 移动导航 $('.toggle-nav').click(function () { $('.mobile-nav').slideToggle(100); }); $('.mobile-nav li a').click(function () { $('.mobile-nav').slideUp(100); }); // 二级 $('.mobile-nav li').on('click', function () { $('.mobile-nav-sub').toggleClass('show'); }); $('.mobile-nav li').on('click', function () { var subMenu = $(this).find('.mobile-nav-sub'); $('.mobile-nav-sub').not(subMenu).hide(); subMenu.toggle('show'); }); // 超高滚动 // 移动端搜索 $('.btn-search').click(function () { $('.btn-search-box').slideToggle(100); }); $('a').click(function () { $('.btn-search-box').slideUp(100); }); // 移动端栏目页导航 $('.banner-nav-button svg').click(function () { $('.banner-nav ul').toggleClass('show'); }); // $('a').click(function () { // $('.banner-nav ul').slideUp(150); // }); // 移动端导航结束 //语言菜单 $('li.language').hover(function () { $('.lang_list').stop().fadeIn(300); }, function () { $('.lang_list').stop().fadeOut(300); }); //语言 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substring(1).match(reg); //获取url中"?"符后的字符串并正则匹配 http://rc.remegen.cn/?lang=1/ // var r = "?lang=2/".substring(1).match(reg); // var r = "?lang=2".substring(1).match(reg); console.log("...r", r) var context = ""; if (r != null) context = r[2]; reg = null; r = null; return context == null || context == "" || context == "undefined" ? "" : context; } // console.log('GetQueryString("lang")', GetQueryString("lang")) function initLang() { var lang = GetQueryString("lang") || localStorage.getItem("lang"); // console.log(lang) switch (lang) { case "1": // 简中 localStorage.setItem("lang", "1"); $(".lang-sim").hide(); $('body').t2s(); $(".lang-tra").s2t(); break; case "2": // 繁中 localStorage.setItem("lang", "2"); $(".lang-tra").hide(); $('body').s2t(); $(".lang-sim").t2s(); break; case "3": // 英文 localStorage.setItem("lang", "3"); $(".lang-enu").hide(); $(".lang-list-item").eq(2).hide(); break; default: // 简中 localStorage.setItem("lang", "1"); $(".lang-sim").hide(); $('body').t2s(); $(".lang-tra").s2t(); break; } /* 简繁切换 */ $(".lang-sim").on("click", function () { localStorage.setItem("lang", "1"); $(this).hide(); $(".lang-tra").show(); $('body').t2s(); }) $(".lang-tra").on("click", function () { localStorage.setItem("lang", "2"); $(this).hide(); $(".lang-sim").show(); $('body').s2t(); }) } initLang(); //风琴 if ($(window).width() > 640) { accor($('#Accor1'), '588', 500, true, false); //参数1:Dom节点,参数2:展开图宽度(值可正数像素值或百分比)、参数3:速度(ms)、参数4:初始是否展开(是true,否false)、参数5:是否点击展开(是true,否false) } else { var swiper = new Swiper('#Accor1', { effect: 'slide', speed: 300, autoplay: { delay: 3000, //展示时间 disableOnInteraction: false } }); } // 公司概况数据 /* $(window).scroll(function() { $('#num').waypoint(function(direction) { start(); }, { offset: '95%' }); }) $(window).scroll(function() { $('#num').waypoint(function(direction) { reset(); }, { offset: '-10%' }); }) $(window).scroll(function() { // $('#num').offset().top - $(window).scrollTop():元素到顶部的距离 // $(window).height()可视区域 if ($('#num').offset().top - $(window).scrollTop() > $(window).height()) { reset(); } }) */ });