function lockScroll () { let widthBar = 17, root = document.documentElement; if ( typeof window.innerWidth == 'number' ) { widthBar = window.innerWidth - root.clientWidth; } root.style.overflow = 'hidden'; root.style.borderRight = widthBar + 'px solid transparent'; } function unlockScroll () { let root = document.documentElement; root.style.overflow = ''; root.style.borderRight = ''; } //鎻掑叆header(pc) //鎻掑叆header(mb) // pc搴曢儴 // 绉诲姩绔簳閮 // 绉诲姩绔睍寮€瀵艰埅鍒楄〃 $( function () { const selectT0 = $( '.t0 .t0-item .icon' ); const selectT1 = $( '.t1 .t1-item .icon' ); const selectT2 = $( '.t2 .t2-item .icon' ); // 澶勭悊鏃犲瓙椤规儏鍐 $.each( $( '.mb-select-list li' ), function ( i, n ) { $( n ).children( 'ul' ).length === 0 ? $( n ).children().children().children( 'img' ).remove() : false; } ) // 鎬昏彍鍗 $( 'header .state' ).click( function () { $( this ).children().toggle() // 鍩虹鍏ㄩ儴缂 $( '.t1' ).slideUp(); $( '.t2' ).slideUp(); $( '.t3' ).slideUp(); // 鍥炬爣閲嶇疆 $( '.icon img:first-child' ).show().siblings().hide(); $( '.mb-select-list' ).finish().slideToggle(); $( this ).children().css( 'display' ) === 'none' ? lockScroll() : unlockScroll(); $('.mb-select-list li>div').removeClass('active') } ) // 绗竴灞 selectT0.click( function () { $( '.t2' ).slideUp(); $( '.t3' ).slideUp(); /*鍥炬爣鍒囨崲*/ $( this ).children().toggle() /*涓嬫媺鑿滃崟change*/ $( this ).parent().next( 'ul' ).finish().slideToggle() /*閲嶇疆鍥炬爣*/ $( '.mb-select-list .t0 ul li .icon' ).children( 'img:first-child' ).show().siblings().hide() } ) // 绗簩灞 selectT1.click( function () { $( '.t3' ).slideUp(); /*鍥炬爣鍒囨崲*/ $( this ).children().toggle() $( this ).parent().next( 'ul' ).finish().slideToggle(); } ) // 绗笁灞 selectT2.click( function () { /*鍥炬爣鍒囨崲*/ $( this ).children().toggle() $( this ).parent().next( 'ul' ).finish().slideToggle(); } ) } ) // 绉诲姩绔睍寮€鍙樺寲 $( function () { $( '.mb-select-list>ul>li>div' ).click( function () { $( this ).next().children().children( 'div' ).removeClass( 'active' ) } ) $( '.mb-select-list li>div .icon' ).click( function () { console.log(2334) if ( $( this ).parent().attr( 'class' ).split( ' ' ).indexOf( 'active' ) > 0 ) { $( this ).parent().removeClass( 'active' ) } else $( this ).parent().addClass( 'active' ) } ) } ) // 鏍囩椤靛垏鎹 $( '.page-tabbar a' ).click( function () { $( this ).addClass( 'active' ).siblings().removeClass( 'active' ) } ) // 瑙嗛鎾斁 $( '.videobox-play>div' ).click( function () { $( '.video-play-box' ).css( { 'display': 'flex', } ); console.log($( this ).parent().attr( 'data-video-url' )) let videoUrl = ""; $( '.video-play-box video' ).attr( 'src', $( this ).parent().attr( 'data-video-url' ) )[ 0 ].play(); // $( '.video-play-box video' )[0].play(); } ); $( '.cha' ).click( function () { $( '.video-play-box video' )[ 0 ].pause(); $( '.video-play-box' ).hide(); } ); // 鑾峰彇褰撳墠缃戠珯 $( function () { function setLine () { const fileName = window.location.pathname.split( '/' ).pop(); $( '.header-nav-list >li>a' ).each( function ( i, n ) { if ( $( n ).attr( 'href' ) === fileName ) { $( n ).parent().addClass( 'line-active' ) return true } } ) } setLine() } ) $( function () { const len = $( '.page-tabbar .left' ).width() // 鎬讳釜鏁 const childNum = $( '.page-tabbar .left a' ).length; // 褰撳墠浣嶇疆 const pos = $( '.page-tabbar .left .active' ).index() $( '.page-tabbar .tab' ).scrollLeft( pos / childNum * len ) } ) $( function () { // 鎼滅储 $( '.searchIcon' ).click( function () { const value = $( '#inputValue' ).val(); window.location.href='/index/index/searchResult?seach='+value; } ) $( '#inputValue' ).keydown(function(event) { const value = $( '#inputValue' ).val(); if (event.which == 13) { window.location.href='/index/index/searchResult?seach='+value; } }); // 鍏抽棴杈撳叆妗 $( '.closeInput' ).click( function () { $( '.component-search-box' ).hide() } ) // 鎵撳紑 $( '.page-top-search' ).click( function () { console.log('open') $( '.component-search-box' ).show(); $('#inputValue').focus(); } ) } )