File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 10
10
</ ul >
11
11
</ div >
12
12
</ div >
13
+
14
+ < script >
15
+
16
+ $ ( "#get-started-contributor-sidebar-list li a" ) . on ( "click" , function ( e ) {
17
+ var href = $ ( this ) . attr ( "href" )
18
+ $ ( 'html, body' ) . stop ( ) . animate ( {
19
+ scrollTop : $ ( href ) . offset ( ) . top - 100
20
+ } , 850 ) ;
21
+ ( e ) . preventDefault ;
22
+ } ) ;
23
+
24
+ var lastId ,
25
+ topMenu = $ ( "#get-started-contributor-sidebar-list" ) ,
26
+ topMenuHeight = topMenu . outerHeight ( ) + 1 ,
27
+ // All sidenav items
28
+ menuItems = topMenu . find ( "a" ) ,
29
+ // Anchors for menu items
30
+ scrollItems = menuItems . map ( function ( ) {
31
+ var item = $ ( this ) . attr ( "href" ) ;
32
+ if ( item . length ) { return item ; }
33
+ } ) ;
34
+
35
+ $ ( window ) . scroll ( function ( ) {
36
+ var fromTop = $ ( this ) . scrollTop ( ) + topMenuHeight ;
37
+ var article = '.pytorch-article'
38
+
39
+ $ ( article ) . each ( function ( i ) {
40
+ var offsetScroll = $ ( this ) . offset ( ) . top - $ ( window ) . scrollTop ( ) ;
41
+ if ( offsetScroll <= topMenuHeight + 200 && offsetScroll >= topMenuHeight - 200 && scrollItems [ i ] == "#" + $ ( this ) . children ( ) . attr ( "id" ) && $ ( ".hidden:visible" ) ) {
42
+ $ ( menuItems ) . removeClass ( "active" ) ;
43
+ $ ( menuItems [ i ] ) . addClass ( "active" ) ;
44
+ }
45
+ } )
46
+ } ) ;
47
+
48
+ </ script >
49
+ < script src ="https://code.jquery.com/jquery-migrate-3.0.0.min.js "> </ script >
You can’t perform that action at this time.
0 commit comments