// 鍏叡灏佽鍑芥暟 /*婊氬姩鍔ㄧ敾*/ function scrollani(ele,_distance) { ele.each(function() { var _this = $(this); if (_this.offset().top > $(window).scrolltop() + $(window).height() || _this.offset().top < $(window).scrolltop() - _this.outerheight()) { // _this.removeclass('animate'); } else if ($(window).scrolltop() > _this.offset().top - $(window).height() * _distance) { _this.addclass('animate'); } }); $(window).scroll(function() { ele.each(function() { var _this = $(this); if (_this.offset().top > $(window).scrolltop() + $(window).height() || _this.offset().top < $(window).scrolltop() - _this.outerheight()) { // _this.removeclass('animate'); } else if ($(window).scrolltop() > _this.offset().top - $(window).height() * _distance) { _this.addclass('animate'); } }); }); } function _showtotop() { var h = $(window).height(); if($(window).scrolltop()>h/3) { $('.totop').stop().fadein(); }else { $('.totop').stop().fadeout(); } } // 璁╁唴椤礲anner鏂囧瓧涓婁笅灞呬腑 function innerbanner() { var _w0 = $(window).width(); if($('.pro-banner').length>0 && _w0 > 1023) { $(".pro-banner .table,.pro-banner .w1280").height($(".pro-banner").height()); } if($('.other-banner').length>0) { var breadheight = $('.bread-wrap').height(); $(".other-banner .table,.other-banner .moudle-titles-wrap").height($(".other-banner").height() - breadheight); } // 缇庡懗璇惧爞banner杞挱 if($('.delicacy-banner').length>0 && _w0 > 1023) { $(".delicacy-list1 .delicacy-banner").height($(".list1-right").height()); } if($('.welcome').length>0) { $('.footer').addclass('in2'); } } // flex甯冨眬鎺掑簭 // function flexorder(ele,num) { // ele.each(function(){ // var _this = $(this); // var _index = _this.index()+1; // if(_index %num == 0) { // _this.addclass('order1'); // } // }); // } //灏戜簬鎸囧畾杞挱涓暟锛岄殣钘忕偣鐐圭偣 function hide_swiper_hd(el1,el2,width,size) { var _s = el1.size(); var _w = $(window).width(); if(_w > width && _s < size) { el2.css('display','none'); } } // 澶撮儴鍜屽簳閮ㄥ鑸? function _shownavigation () { var _w = $(window).width(); if(_w < 1024) { $('.header .nav-a').addclass('nav-a-m'); $('.footer .nav-a').addclass('nav-a-m'); }else { $('.header-nav .nav-item').hover(function(){ $(this).find('.sub-hides').stop().slidedown().parent().siblings().find('.sub-hides').stop().slideup(); },function(){ $(this).find('.sub-hides').stop().slideup(); }); } } // 澶村簳鍙婂叕鍏卞嚱鏁? $(function(){ innerbanner(); _shownavigation(); $(window).resize(function(){ innerbanner(); _shownavigation(); }); scrollani($('.js-m'),.88); scrollani($('.js-to-left'),.88); scrollani($('.js-to-right'),.88); scrollani($('.js-scale'),.88); scrollani($('.js-scale2'),.88); $('.header-nav .nav-a-m').click(function(){ var _this = $(this); if(_this.hasclass('cur')) { _this.toggleclass('cur').parent().toggleclass('cur').siblings().removeclass('cur').find('.nav-a').removeclass('cur'); $(".header-nav").find('.sub-hides').stop().slideup(); }else { _this.toggleclass('cur').parent().toggleclass('cur').siblings().removeclass('cur').find('.nav-a').removeclass('cur'); _this.parent().find('.sub-hides').stop().slidedown().parent().siblings().find('.sub-hides').stop().slideup(); } }); $('.footer .nav-a-m').click(function(){ var _this = $(this); if(_this.hasclass('cur')) { _this.removeclass('cur'); $(".footer").find('.sub-hides').stop().slideup(); }else { _this.addclass('cur'); _this.parent().find('.sub-hides').stop().slidedown().parent().siblings().find('.sub-hides').stop().slideup(); } }); $('.header,.right-fixed').addclass('animate'); $('.search-btn').click(function(){ $('.header .logo').addclass('onlypc'); $('.m-nav-btn').addclass('hide2'); $('.search-box,.close-form').addclass('show1'); $('.header-nav,.header-right-img,.search-btn').addclass('hide1'); }); $('.close-form').click(function(){ $('.m-nav-btn').removeclass('hide2'); $('.header .logo').removeclass('onlypc'); $('.search-box,.close-form').removeclass('show1'); $('.header-nav,.header-right-img,.search-btn').removeclass('hide1'); }); $(".header .m-nav-btn").on('click', function() { var _this = $(this); if(_this.hasclass('cur')) { _this.removeclass('cur'); $(".header").find('.header-nav').stop().slideup(); }else { $('.m-nav-btn').addclass('cur'); $(".header").find('.header-nav').stop().slidedown(); } }); // 鍙充晶鍥哄畾鐢佃瘽 $('.fixed-a').eq(3).hover(function(){ $('.tele-hide').stop().fadein(); },function() { $('.tele-hide').stop().fadeout(); }); _showtotop(); $(window).scroll(function(){ _showtotop(); }); $('.totop').click(function(){ $("html,body").animate({"scrolltop": "0px"}, "slow"); }); })