$(function () { // 移动端导航打开、关闭 if($(window).width() < 769){ $('.navbtn').click(function (e) { $(this).toggleclass('navclose'); $('.nav').stop(true, false).toggleclass('nav-open'); $('html').toggleclass('nav-open'); e.stoppropagation(); }); $('.nav ul li').each(function(){ if($(this).children('.sub-nav').length > 0){ $(this).children('a').attr('href','javascript:;'); } }) } //nav $('.nav').mouseleave(function () { $('.sub-nav').slideup(200); }) $('.nav ul li').hover(function () { var subnav = $(this).children('.sub-nav'); $(this).children('.sub-nav').stop(true, false).slidedown(200); $(this).siblings().children('.sub-nav').stop(true, false).slideup(200); }) $('.pro-nav .container .item').each(function () { var itemheight = $(this).height(); harray = new array(); harray.push(itemheight); }) $('.lang-btn').click(function (e) { $(this).toggleclass('active'); $(this).siblings('.list').stop(true, false).slidetoggle(200); e.stoppropagation(); }) $('html, body').click(function (e) { $('.lang-btn').siblings('.list').slideup(200); e.stoppropagation(); }) $('.search-btn').click(function () { $('.search-wrapper').fadein(200); $('html, body').css('overflow', 'hidden') }) $('#searchclose').click(function () { $('.search-wrapper').fadeout(200); $('html, body').css('overflow', 'auto') }) }); function setnav(index) { $(function () { $(".nav > ul > li > a[data-title='"+index+"']").addclass("current"); }); } function getquerystringbyname(name) { var result = location.search.match(new regexp("[\?\&]" + name + "=([^\&]+)", "i")); if (result == null || result.length < 1) { return ""; } return result[1]; }