Explorar o código

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

Frederic G. MARAND %!s(int64=8) %!d(string=hai) anos
pai
achega
4795ad302c
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  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>');
   });
 });