$(function () { //$('#topNav .navbar').hover(function () { // $(this).addClass('navbar-default') //}, function () { // $(this).removeClass('navbar-default') //}); $('video').bind("contextmenu", function () {//取消右键事件 return false; }); //popBox(); $('#link_login').click(function () { //popBox(); $('.collapse').collapse('hide') }); $('#link_login-xs').click(function () { //popBox(); $('.collapse').collapse('hide') }); $('#topNav .dropdown').on('show.bs.dropdown', function (e) { $(this).find('.dropdown-menu').first().stop(true, true).slideDown(150); }); $('#topNav .dropdown').on('hide.bs.dropdown', function (e) { $(this).find('.dropdown-menu').first().stop(true, true).slideUp(0); }); $("#topNav .navbar-nav>li").hover(function () { if ($(this).hasClass('open')) { $(this).trigger('hide.bs.dropdown'); } else { $(this).trigger('show.bs.dropdown'); } }, function () { $(this).trigger('hide.bs.dropdown'); }); $('.product-menu .dropdown').on('show.bs.dropdown', function (e) { $(this).find('.dropdown-menu').first().stop(true, true).slideDown(150); }); $('.product-menu .dropdown').on('hide.bs.dropdown', function (e) { $(this).find('.dropdown-menu').first().stop(true, true).slideUp(0); }); //$(".product-menu>li").hover(function () { // if ($(this).hasClass('open')) { // $(this).trigger('hide.bs.dropdown'); // } else { // $(this).trigger('show.bs.dropdown'); // } //}, function () { // $(this).trigger('hide.bs.dropdown'); //}); var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); _showToTop(); $(window).scroll(function () { _showToTop(); }); $('#scrollUp').click(function () { window.scrollTo(0, 0); }); $('#service').click(function () { window.location.href = "/Article/Index/2"; }); $('#link_search').click(function () { $('.nav-container').addClass('hideNav'); $('.top-search').removeClass('hideNav'); $('.top-search').addClass('showNav'); $('.collapse').collapse('hide') }); $('.Search_Btn_Close').click(function () { $('.nav-container').removeClass('hideNav'); $('.top-search').removeClass('showNav'); $('.top-search').addClass('hideNav'); }); $('#link_search-xs').click(function () { $('.nav-container').addClass('hideNav'); $('.top-search').removeClass('hideNav'); $('.top-search').addClass('showNav'); $('.collapse').collapse('hide') }); $('#bs-example-navbar-collapse-1-xs').on('show.bs.collapse', function () { $('.bar1').addClass('route-icon-bar1'); $('.bar2').addClass('route-icon-bar2'); $('.bar-close').show(); $('.bar-open').hide(); //var popLayer = document.getElementById("popLayer"); //popLayer.style.display = "block"; unScroll(); //alert('show'); }) $('#bs-example-navbar-collapse-1-xs').on('hide.bs.collapse', function () { $('.bar1').removeClass('route-icon-bar1'); $('.bar2').removeClass('route-icon-bar2'); $('.bar-close').hide(); $('.bar-open').show(); //var popLayer = document.getElementById("popLayer"); //popLayer.style.display = "none"; removeUnScroll(); //alert('hide'); }) $('#bs-example-navbar-collapse-1-xs .dropdown').on('show.bs.dropdown', function () { $(this).find('img').attr('src', '/pic/Home/divide.png'); }) $("#bs-example-navbar-collapse-1-xs .dropdown").on("hide.bs.dropdown", function () { $(this).find('img').attr('src', '/pic/Home/plus.png'); }); }); function DarkNav() { if (isSmallNav()) { $('body').css('margin-top', '45px'); return; }; $('body').css('margin-top', '0px'); SetDark(); $('#link_lang span').css('color', '#FFF'); $("#logo").attr('src', '/pic/logo_white.png'); $("#logo-en").attr('src', '/pic/logo-en-white.png'); $("#link_search .search-icon").css('background-image', "url('/pic/Search/search-icon-white.png')"); $("#login").attr('src', '/pic/login-white.png'); $("#lang-cn").attr('src', '/pic/CN_white.png'); $("#lang-en").attr('src', '/pic/EN_white.png'); // $("#lang-cn").attr('src', '/pic/CN.png'); //$("#lang-en").attr('src', '/pic/EN.png'); if ($(window).scrollTop() > 1) { SetLight(); } $(window).resize(function () { if ($(window).scrollTop() > 1) { SetLight(); } else { SetDark(); } }); $(window).scroll(function () { if ($(window).scrollTop() > 1) { SetLight(); } else { SetDark(); } }); $('#topNav').hover(function () { SetLight(); }, function () { SetDark() }); } function SetDark() { //$('.arrow').attr('src', '/pic/Home/arrow1.png'); if ($(window).scrollTop() > 1) { SetLight(); return; } $('#topNav').stop().animate({ 'backgroundColor': 'transparent' }, 10); $('#topNav .navbar-nav > .active > a').each(function () { if ($(this).hasClass('NavLightLink') === true) { $(this).removeClass('NavLightLink'); } if ($(this).hasClass('NavDarkLink') === false) { $(this).addClass('NavDarkLink'); } }); $('#topNav .navbar-nav >li> a').each(function () { if ($(this).hasClass('NavLightLink') === true) { $(this).removeClass('NavLightLink'); } if ($(this).hasClass('NavDarkLink') === false) { $(this).addClass('NavDarkLink'); } }); $('#link_lang span').css('color', '#FFF'); $("#logo").attr('src', '/pic/logo_white.png'); $("#logo-en").attr('src', '/pic/logo-en-white.png'); $("#link_search .search-icon").css('background-image', "url('/pic/Search/search-icon-white.png')"); $("#login").attr('src', '/pic/login-white.png'); //$("#lang-cn").attr('src', '/pic/CN.png'); //$("#lang-en").attr('src', '/pic/EN.png'); $("#lang-cn").attr('src', '/pic/CN_white.png'); $("#lang-en").attr('src', '/pic/EN_white.png'); } function SetLight() { //$('.arrow').attr('src', '/pic/Home/arrow2.png'); $('#topNav').stop().animate({ 'backgroundColor': '#fff' }, 10); //$('#topNav .navbar-nav > .active > a, #topNav .navbar-nav > .active > a:hover, #topNav .navbar-nav > .active > a:focus').css('color', '#2C6CFC'); $('#topNav .navbar-nav > .active > a').each(function () { if ($(this).hasClass('NavDarkLink') === true) { $(this).removeClass('NavDarkLink'); } if ($(this).hasClass('NavLightLink') === false) { $(this).addClass('NavLightLink'); } }); $('#topNav .navbar-nav >li> a').each(function () { if ($(this).hasClass('NavDarkLink') === true) { $(this).removeClass('NavDarkLink'); } if ($(this).hasClass('NavLightLink') === false) { $(this).addClass('NavLightLink'); } }); $('#link_lang span').css('color', '#343434'); $("#logo").attr('src', '/pic/logo.png'); $("#logo-en").attr('src', '/pic/logo-en.png'); $("#link_search .search-icon").css('background-image', "url('/pic/Search/search-icon-black.png')"); $("#login").attr('src', '/pic/login1.png'); $("#lang-cn").attr('src', '/pic/CN.png'); $("#lang-en").attr('src', '/pic/EN.png'); //$("#lang-cn").attr('src', '/pic/CN_white.png'); //$("#lang-en").attr('src', '/pic/EN_white.png'); } function isSmallNav() { var w = $(window).width(); if (w < 1200) { return true; } return false; } function isMobile() { var mobile_flag = false; var screen_width = window.screen.width; var screen_height = window.screen.height; //根据屏幕分辨率判断是否是手机 if (screen_width < 500 && screen_height < 800) { mobile_flag = true; } //console.log(screen_width) //if (screen_width < 1200) { // mobile_flag = true; //} return mobile_flag; } function _showToTop() { var h = $(window).height(); if ($(window).scrollTop() > h / 3) { $('#side-container').stop().fadeIn(); } else { $('#side-container').stop().fadeOut(); } } /*点击弹出按钮*/ function popBox() { var popBox = document.getElementById("popBox"); var popLayer = document.getElementById("popLayer"); popBox.style.display = "block"; popLayer.style.display = "block"; unScroll(); }; /*点击关闭按钮*/ function closeBox() { var popBox = document.getElementById("popBox"); var popLayer = document.getElementById("popLayer"); popBox.style.display = "none"; popLayer.style.display = "none"; removeUnScroll(); } function unScroll() { document.documentElement.style.overflow = 'auto'; window.scrollTo(0, 0); var top = $(document).scrollTop(); $(document).on('scroll.unable', function (e) { $(document).scrollTop(top); }) } function removeUnScroll() { document.body.style.position = 'static'; $(document).unbind("scroll.unable"); } function activeMainNav(id) { $('.mainNav li').removeClass('active'); $('#' + id).addClass('active'); } function OpenDropDown(d) { $(d).click(function () { if ($(this).hasClass('open')) { $(this).trigger('hide.bs.dropdown'); } else { $(this).trigger('show.bs.dropdown'); } }); }