Skip to content

Instantly share code, notes, and snippets.

@sivartravis
Forked from devdays/footnotes-0.0.2.js
Created September 19, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivartravis/209913132bd993d5d1bf78801f11e7c6 to your computer and use it in GitHub Desktop.
Save sivartravis/209913132bd993d5d1bf78801f11e7c6 to your computer and use it in GitHub Desktop.
Sample for moving footnotes using jQuery plugin
(function ($) {
$.fn.footnote = function () {
// console.log("footnote");
var footnotes = this.find("span.footnote");
footnotes.each(function (key, value) {
//console.log("footnote" + key + " : " + $(value).contents().text());
var footnoteContentsNode = $(value).clone();
var footnoteNumberTextNode = document.createTextNode("[" + key + "] ");
$("#references").append(footnoteNumberTextNode).append(footnoteContentsNode).css("color", "blue").append("<br />");
$(value).text("[" + key + "] ").css("color", "blue").css("vertical-align", "super").css("font-size", "60%");
});
return footnotes;
};
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment