// jq扩展 var $win = $(window), winH = $win.height(); $.fn.extend({ active: function() { $(this).addClass('active').siblings().removeClass('active'); return $(this) } }) $('.others-bar .share-list a .code').hide(); $('.others-bar .share-list a').mouseenter(function() { $(this).find('.code').show(); }) $('.others-bar .share-list a').mouseleave(function() { $(this).find('.code').hide(); }) $('.menu-container .outer-wrap .scroll-wrap .wrap .menu-contact .contact-list a').mouseenter(function() { $(this).find('.code').show(); }) $('.menu-container .outer-wrap .scroll-wrap .wrap .menu-contact .contact-list a').mouseleave(function() { $(this).find('.code').hide(); }) // 产品列表 // 切换延时显示页面滚动条 var toggle_timer; $('.projects_switch').click(function() { clearTimeout(toggle_timer); $('.products-container').addClass('open'); $('body').css({ overflow: 'hidden' }); }) $('.products-container .close').click(function() { $('.products-container').removeClass('open'); toggle_timer = setTimeout(function() { $('body').css({ overflow: 'visible' }) }, 1000) }) // 产品列表 $('.menu_switch,.menu-switch').click(function() { console.log(111) clearTimeout(toggle_timer); $('.menu-container').addClass('open'); $('body').css({ overflow: 'hidden' }); }) $('.menu-container .close').click(function() { $('.menu-container').removeClass('open'); toggle_timer = setTimeout(function() { $('body').css({ overflow: 'visible' }) }, 1000) }) function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) return unescape(r[2]); return null; //返回参数值 } var className = getUrlParam('class'); $(function() { var height = 0; if($win.width() <= 1080){ height = ($('.floatheader').height() * 2) } else{ height = ($('.headerPage').height() * 2) + $('.n-nav').height(); } if (className) { for (var i = 0; i < $('.n-nav ul li').length; i++) { if ($('.n-nav ul li').eq(i).attr('data-class') == className) { $('.n-nav ul li').eq(i).addClass(' on') } else{ $('.n-nav ul li').eq(i).removeClass(' on') } } var t_a = $('.' + className + '').offset(); $("html,body").animate({ scrollTop: t_a.top - height + "px" }, 500); } }) $('.n-nav ul li').click(function() { var classNode = $(this).attr('data-class'); var height = ($('.headerPage').height() * 2) + $('.n-nav').height(); if (classNode) { $(this).addClass(' on').siblings().removeClass() var t_a = $('.' + classNode + '').offset(); $("html,body").animate({ scrollTop: t_a.top - height + "px" }, 500); } }) $('.headerPage .nav ul li').mouseenter(function() { if ($(this).find('a').html() == '招商加盟') { $(this).parents('body').find('.fixedNav').stop().animate({ 'top': '140px' }, 300) } }) $('.banner').mouseenter(function() { $(this).parents('body').find('.fixedNav').stop().animate({ 'top': '60px' }, 300) }) $('.main').mouseenter(function() { $(this).parents('body').find('.fixedNav').stop().animate({ 'top': '60px' }, 300) }) // $win.scroll(function() { // var scrollTop = $win.scrollTop(); // // 头部 // var header = $('.floatheader'); // // console.log(header) // if (scrollTop > $('.header.static').height()) { // if (header.hasClass('move')) { // header.removeClass('move'); // $('.headerPage').hide() // } // } else { // if (!header.hasClass('move')) { // header.addClass('move'); // $('.headerPage').show() // } // } // }).resize(function() { // $win.scroll(); // winH = $win.height(); // if (window.innerWidth > 600) { // $('.first-page').css({ // height: winH + 'px' // }) // } // }); // $win.resize().scroll();