var main = { top:function(index){ m = index $('#m' + m).addclass('active').siblings().removeclass('active') }, sub:function(index){ sub = index $('#sub' + sub).addclass('active').siblings().removeclass('active').parents('li').siblings().find('dd').removeclass('active') }, fixedheader:function(){ $(window).scroll(function(){ var headerh = 0 $(window).resize(function(){ if($(window).width() > 1024){ headerh = $('.header').outerheight() + $('.header .sub').outerheight() }else{ headerh = $('.header').outerheight() } }).trigger('resize') var banh = $('.banner')?.outerheight() || headerh var scrolltop = $(window).scrolltop(); if(scrolltop + headerh > banh){ $('.header').addclass('fixed') }else{ $('.header').removeclass('fixed') } }).trigger('scroll') }, pronav:function(){ // $(window).scroll(function(){ // var banh = $('.banner')?.outerheight() || 0 // var scrolltop = $(window).scrolltop(); // if(scrolltop > banh){ // $('.pro-nav').addclass('fixed') // }else{ // $('.pro-nav').removeclass('fixed') // } // }).trigger('scroll') }, select:function(){ $(document).on('click','.select',function(e){ e.stoppropagation() $(this).find('label').stop().toggleclass("active") }); $(document).click(function(){ $(this).find('label').stop().removeclass("active") }) $(document).on('change','.select select',function(){ // console.log($(this).siblings('label')); console.log($(this).find('option:checked')); $(this).siblings('label').find('.label').text($(this).find('option:checked').text()) }).trigger('change') } }