ソースを参照

Listing 5.6: add "back to top" links.

Frederic G. MARAND 9 年 前
コミット
a017828cef
1 ファイル変更5 行追加1 行削除
  1. 5 1
      Chapter 5/05.js

+ 5 - 1
Chapter 5/05.js

@@ -1,7 +1,7 @@
 $(document).ready(function () {
   'use strict';
 
-// Use attr() to add an id, rel, and title.
+  // Use attr() to add an id, rel, and title.
   $('div.chapter a[href*="wikipedia"]').attr({
     rel: 'external',
     title: function () {
@@ -11,4 +11,8 @@ $(document).ready(function () {
       return 'wikilink-' + index;
     }
   });
+
+  // Add "back to top" links.
+  $('<a href="#top">back to top</a>');
+  $('<a id="top"></a>');
 });