File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed
components/driver-content-nav Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ export const DriverContentNav = observer<IDriverContentNav>( ( { className } ) =
3030
3131 // event.preventDefault();
3232
33- console . log ( `CHANGE_PAGE_POSITION` ) ;
3433 // let link = event.target as HTMLLinkElement;
3534 // let elementId = link.href.replace( /(.*)?#/, `` );
3635 // let element = document.getElementById( decodeURIComponent( elementId ) ) as HTMLElement;
Original file line number Diff line number Diff line change @@ -8,25 +8,28 @@ export function useContentAutoscroll(){
88
99 useEffect ( ( ) => {
1010 function scrollHandler ( ) {
11- if ( window . scrollX === 0 ) {
12- window . removeEventListener ( "scroll" , scrollHandler ) ;
13-
14- // hack for mobile
15- setTimeout ( ( ) => {
16- if ( scrollX > 0 ) {
17- document . scrollingElement . scrollLeft = 0 ;
18- }
19- } )
20-
21- return ;
22- }
23- document . scrollingElement . scrollLeft = 0 ;
11+ // if (window.scrollX === 0) {
12+ // window.removeEventListener("scroll", scrollHandler);
13+ //
14+ // // hack for mobile
15+ // setTimeout(()=>{
16+ // if ( scrollX > 0 ) {
17+ // document.scrollingElement.scrollLeft = 0;
18+ // }
19+ // })
20+ //
21+ // return;
22+ // }
23+ // document.scrollingElement.scrollLeft = 0;
2424 }
2525
2626 function startHashChangeHandler ( ) {
27- let hash = location . hash . slice ( 1 ) ;
28- goToAnchor ( hash ) ;
29- window . addEventListener ( "scroll" , scrollHandler ) ;
27+ setTimeout ( ( ) => {
28+ let hash = location . hash . slice ( 1 ) ;
29+
30+ goToAnchor ( hash ) ;
31+ window . addEventListener ( "scroll" , scrollHandler ) ;
32+ } , 100 ) ;
3033 }
3134
3235 window . addEventListener ( "scroll" , scrollHandler ) ;
You can’t perform that action at this time.
0 commit comments