|
|
| 第137行: |
第137行: |
| applyFadeColor(); | | applyFadeColor(); |
|
| |
|
| // var firstActive = document.querySelector( '#gf-homepage .gf-tab.active' );
| | var firstActive = document.querySelector( '#gf-homepage .gf-tab.active' ); |
| // if ( firstActive ) {
| | if ( firstActive ) { |
| // setTimeout( function () { moveIndicator( firstActive ); }, 50 );
| | setTimeout( function () { moveIndicator( firstActive ); }, 50 ); |
| // }
| | } |
|
| |
|
| var firstActive = document.querySelector( '#gf-homepage .gf-tab.active' );
| |
| if ( firstActive ) {
| |
| setTimeout( function () {
| |
| var switcher = document.getElementById( 'gf-switcher' );
| |
| var sr = switcher.getBoundingClientRect();
| |
| var tr = firstActive.getBoundingClientRect();
| |
| console.log( 'switcher left:', sr.left );
| |
| console.log( 'tab left:', tr.left );
| |
| console.log( 'tab width:', firstActive.offsetWidth );
| |
| console.log( 'calculated offset:', tr.left - sr.left );
| |
| console.log( 'indicator:', document.getElementById( 'gf-tab-indicator' ) );
| |
| moveIndicator( firstActive );
| |
| }, 50 );
| |
| }
| |
| tabs.forEach( function ( tab ) { | | tabs.forEach( function ( tab ) { |
| tab.addEventListener( 'click', function () { | | tab.addEventListener( 'click', function () { |
少女前线系列多游戏首页切换Widget。调用方式:{{#widget:GameSwitcher}}