File tree 13 files changed +1314
-1114
lines changed
13 files changed +1314
-1114
lines changed Original file line number Diff line number Diff line change 1
1
</div><!-- end #content -->
2
2
3
- <script type="text/javascript" charset="utf-8">
4
- $(function() {
5
- var headerHeight = $("#header").height();
6
- var offsets = [];
7
- var current = -1;
8
-
9
- function endpoint(scrollDistance) {
10
- if (scrollDistance < offsets[0]) {
11
- return -1;
12
- } else {
13
- for (var id = offsets.length; id > 0; id--) {
14
- if (scrollDistance > offsets[id - 1]) {
15
- return id - 1;
16
- break;
17
- }
18
- }
19
- }
20
- }
21
-
22
- $("h2").each(function(i) {
23
- offsets.push($(this).offset().top - headerHeight)
24
- });
25
-
26
- $("#content").append('<h2 class="fixed" style="display: none"><span> </span></h2>');
27
- var fixed_h2 = $("h2.fixed");
28
- var fixed_span = $("h2.fixed span");
29
-
30
- $("#content").scroll(function() {
31
- var scrollDistance = $("#content").attr('scrollTop');
32
- var now = endpoint(scrollDistance);
33
-
34
- if (now !== current) {
35
- $("#sidebar li").removeClass("current");
36
- current = now;
37
- if (current < 0) {
38
- fixed_h2.hide();
39
- } else if (current >= 0) {
40
- var heading = $($("h2 span")[current]).text();
41
- $("#sidebar a[href|=#" + heading.replace(' ', '-') + "]").parent().addClass("current");
42
- fixed_span.text(heading);
43
- fixed_h2.show();
44
- }
45
- }
46
- });
47
- });
48
- </script>
3
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
4
+ <script type="text/javascript" src="media/js/script.js"></script>
49
5
50
6
</body>
51
7
</html>
Original file line number Diff line number Diff line change 4
4
<title>%(title)s</title>
5
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
6
<link rel="stylesheet" type="text/css" href="media/css/style.css">
7
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script >
7
+ <link rel="stylesheet" type="text/css" href="media/css/highlight.css" >
8
8
</head>
9
9
<body>
10
10
<div id="header">
Original file line number Diff line number Diff line change
1
+
2
+ /* eslint-disable */
3
+
4
+ $ ( function ( ) {
5
+ var headerHeight = $ ( "#header" ) . height ( ) ;
6
+ var offsets = [ ] ;
7
+ var current = - 1 ;
8
+
9
+ function endpoint ( scrollDistance ) {
10
+ if ( scrollDistance < offsets [ 0 ] ) {
11
+ return - 1 ;
12
+ } else {
13
+ for ( var id = offsets . length ; id > 0 ; id -- ) {
14
+ if ( scrollDistance > offsets [ id - 1 ] ) {
15
+ return id - 1 ;
16
+ break ;
17
+ }
18
+ }
19
+ }
20
+ }
21
+
22
+ $ ( "h2" ) . each ( function ( i ) {
23
+ offsets . push ( $ ( this ) . offset ( ) . top - headerHeight )
24
+ } ) ;
25
+
26
+ $ ( "#content" ) . append ( '<h2 class="fixed" style="display: none"><span> </span></h2>' ) ;
27
+ var fixed_h2 = $ ( "h2.fixed" ) ;
28
+ var fixed_span = $ ( "h2.fixed span" ) ;
29
+
30
+ $ ( "#content" ) . scroll ( function ( ) {
31
+ var scrollDistance = $ ( "#content" ) . attr ( 'scrollTop' ) ;
32
+ var now = endpoint ( scrollDistance ) ;
33
+
34
+ if ( now !== current ) {
35
+ $ ( "#sidebar li" ) . removeClass ( "current" ) ;
36
+ current = now ;
37
+ if ( current < 0 ) {
38
+ fixed_h2 . hide ( ) ;
39
+ } else if ( current >= 0 ) {
40
+ var heading = $ ( $ ( "h2 span" ) [ current ] ) . text ( ) ;
41
+ $ ( "#sidebar a[href|=#" + heading . replace ( ' ' , '-' ) + "]" ) . parent ( ) . addClass ( "current" ) ;
42
+ fixed_span . text ( heading ) ;
43
+ fixed_h2 . show ( ) ;
44
+ }
45
+ }
46
+ } ) ;
47
+ } ) ;
You can’t perform that action at this time.
0 commit comments