Ver código fonte

Listing 5.15: more join() to build footnote links.

Frederic G. MARAND 8 anos atrás
pai
commit
4795ad302c
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      Chapter 5/05.js

+ 7 - 2
Chapter 5/05.js

@@ -22,11 +22,16 @@ $(document).ready(function () {
   $('span.footnote').each (function (index) {
     $(this)
       .before([
+        '<a href="#footnote-',
+        index + 1,
+        '" id="context-',
+        index + 1,
+        '" class="context">',
         '<sup>',
         index + 1,
-        '</sup>'
+        '</sup></a>'
       ].join(''))
       .appendTo($notes)
-      .wrap('<li></li>');
+      .wrap('<li id="footnote-' + (index + 1) + '"></li>');
   });
 });