This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Footnoter</title> | |
</head> | |
<body> | |
<p id="myParagraph"> | |
In up so discovery my middleton eagerness dejection explained. Estimating excellence ye contrasted | |
insensible as. Oh up unsatiable <span class="footnote">Unpacked reserved sir.</span> interested. | |
Present suppose in esteems indemesne colonel it to. End horrible she landlord screened stanhill. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.footnote = function (options) { | |
// This is the easiest way to have default options. | |
var settings = $.extend({ | |
// These are the defaults. | |
color: "blue", | |
referencesLocation: "#references" | |
}, options); | |
// use the options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$("#myParagraph").footnote().css("background-color", "yellow"); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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%"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.footnote = function () { | |
console.log("footnote"); | |
var footnotes = this.find("span.footnote"); | |
footnotes.css("color", "red"); | |
return footnotes; | |
}; | |
}(jQuery)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ( $ ) { | |
// use $ in your code as the jQuery alias here | |
}( jQuery )); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Footnoter</title> | |
</head> | |
<body> | |
<p id="myParagraph"> | |
In up so discovery my middleton eagerness dejection explained. Estimating excellence ye contrasted | |
insensible as. Oh up unsatiable <span class="footnote">Unpacked reserved sir.</span> interested. | |
Present suppose in esteems indemesne colonel it to. End horrible she landlord screened stanhill. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.greenify = function() { | |
this.css( "color", "green" ); | |
}; | |
$( "a" ).greenify(); // Makes all the links green. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="border: 1px solid orange"> | |
<span style="width: 300px; margin-left: 100px; padding: 3px 3px 3px 3px; | |
background-color: lightgreen">Now is the time for all good men to come to the aid of their country. The quick fox jumped over the lazy dog.</span> | |
<span style="width: 300px; margin-left: 100px; padding: 3px 3px 3px 3px; | |
background-color: lightgreen">Now is the time for all good men to come to the aid of their country. The quick fox jumped over the lazy dog.</span> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
border: 1px solid red !important; | |
} |