{"id":164,"date":"2016-04-20T06:00:20","date_gmt":"2016-04-20T10:00:20","guid":{"rendered":"http:\/\/ecologybits.com\/?p=164"},"modified":"2016-04-19T21:21:14","modified_gmt":"2016-04-20T01:21:14","slug":"fancy-footnotes-for-the-fearless","status":"publish","type":"post","link":"http:\/\/ecologybits.com\/index.php\/2016\/04\/20\/fancy-footnotes-for-the-fearless\/","title":{"rendered":"Fancy Footnotes for the Fearless"},"content":{"rendered":"<p>Back in February, I implored you to <a href=\"http:\/\/ecologybits.com\/index.php\/2016\/02\/08\/stop-using-unlinked-footnotes\/\" target=\"_blank\">stop using unlinked footnotes<\/a> in your blog posts. The intrepid Stephen Heard <span class=\"ref\"><span class=\"refnum\">[1]<\/span><span class=\"refbody\"> of <a href=\"https:\/\/scientistseessquirrel.wordpress.com\/\" target=\"_blank\">Scientist Sees Squirrel<\/a> fame, not the 18th century governor of Georgia<\/span><\/span> pointed out that that linking is a little kludgy. The return anchor can only be at the beginning of a paragraph, so it&#8217;s not an exact jump. And in my browser, my WordPress banner overhangs the link, so I don&#8217;t actually see the line I&#8217;m jumping to. Yes, a little kludgy. But so much better than no link.<\/p>\n<p>Then Stephen wondered whether it would be possible to do pop-up footnotes, like in Randall Monroe&#8217;s <span class=\"ref\"><span class=\"refnum\">[2]<\/span><span class=\"refbody\"> of XKCD fame, <del>not the former NASA roboticist<\/del><\/span><\/span> <a href=\"https:\/\/what-if.xkcd.com\/\" target=\"_blank\">&#8220;What If?&#8221;<\/a> series. When you click these links, a little box pops up and displays the footnoted text. It&#8217;s slick and has a more modern feel.\u00a0It doesn&#8217;t require any scrolling and is less kludgy than linked footnotes. So I looked into it, and the answer is yes! <span class=\"ref\"><span class=\"refnum\">[3]<\/span><span class=\"refbody\"> Well, the answer is yes! if you host your own blog. If you&#8217;re using a free blog hosted on wordpress.COM, you&#8217;re out of luck. You get what you pay for, I guess. Sorry, Stephen.<\/span><\/span><\/p>\n<p>It&#8217;s not even that hard. You have to manually add a couple pieces of code to your blog website, but doing so is a one-time deed and takes less than five minutes. Then you simply add a little HTML around your footnotes and voila! Stunning pop-up footnotes.<\/p>\n<p>Here&#8217;s how on WordPress:<\/p>\n<ol>\n<li>In your WordPress control panel, go to &#8220;Appearance&#8221; and then &#8220;Editor.&#8221; You can now manually edit your blog pages. Careful here.<\/li>\n<li>The first file to edit is your style sheet. It will be called &#8220;style.css&#8221;. Somewhere in it (at the end is fine), add the following code <span class=\"ref\"><span class=\"refnum\">[4]<\/span><span class=\"refbody\"> <del>stolen<\/del> borrowed from Randall&#8217;s &#8220;What If?&#8221; site<\/span><\/span>:\n<pre>.ref {\r\nposition: relative;\r\nvertical-align: baseline;\r\n}\r\n\r\n.refnum {\r\nposition: relative;\r\nleft: 2px;\r\nbottom: 1ex;\r\nfont-family: Verdana, sans-serif;\r\ncolor: #005994;\r\nfont-size: .7em;\r\nfont-weight: bold;\r\ntext-decoration: underline;\r\ncursor: pointer;\r\n}\r\n\r\n.refbody {\r\nfont-family: Verdana, sans-serif;\r\nfont-size: .7em;\r\nline-height: 1.1;\r\ndisplay: block;\r\nmin-width: 20em;\r\nposition: absolute;\r\nleft: 25px;\r\nbottom: 5px ;\r\nborder: 1px solid;\r\npadding: 5px;\r\nbackground-color: #fff;\r\nword-wrap: break-word;\r\nz-index: 9999;\r\noverflow: auto;\r\n}<\/pre>\n<li>You can play with the values in here to customize the look\u00a0to your liking. Save your edits.<\/li>\n<li>Then you want to edit your header template. It will be called &#8220;header.php&#8221;. In the header part of the file (right before the <code>&lt;\/head&gt;<\/code>\u00a0tag is good), you want to paste in the following code:\n<pre>\r\n&lt;script src=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.10.1\/jquery.min.js\"&gt;\r\n&lt;\/script&gt;\r\n&lt;script&gt;\r\njQuery.noConflict();\r\njQuery(function() {\r\njQuery(\".refbody\").hide();\r\njQuery(\".refnum\").click(function(event) {\r\njQuery(this.nextSibling).toggle();\r\nevent.stopPropagation();\r\n});\r\njQuery(\"body\").click(function(event) {\r\njQuery(\".refbody\").hide();\r\n});\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<\/li>\n<li>Save those edits.<\/li>\n<li>Now you&#8217;re ready to write a post with a pop-up footnote. To do so, type the link you want (such as &#8220;[5]&#8221;) and the text you want to pop up.<\/li>\n<li>Switch to &#8220;Text&#8221; mode\u00a0from \u201cVisual\u201d mode. There\u2019s a little tab to do this in the upper right, when you\u2019re composing a new post.<\/li>\n<li>Before the link, add these tags:\u00a0<code>&lt;span class=\"ref\"&gt;&lt;span class=\"refnum\"&gt;<\/code><\/li>\n<li>Between the link and the text you want to pop up, add these tags:\u00a0<code>&lt;\/span&gt;&lt;span class=\"refbody\"&gt;<\/code><\/li>\n<li>And after the text you want to pop up, add these tags:\u00a0<code>&lt;\/span&gt;&lt;\/span&gt;<\/code><\/li>\n<li>So, for example, my HTML for this <span class=\"ref\"><span class=\"refnum\">[5]<\/span><span class=\"refbody\"> One, two, five!<\/span><\/span> footnote reads\u00a0<code>&lt;span class=\"ref\"&gt;&lt;span class=\"refnum\"&gt;[5]&lt;\/span&gt;&lt;span class=\"refbody\"&gt; One, two, five!&lt;\/span&gt;&lt;\/span&gt;<\/code><\/li>\n<\/ol>\n<p>That should do it. If you blog on a non-WordPress platform and you have edit access to your blog&#8217;s files, the steps should be virtually the same. You&#8217;ll need to add CSS code to your stylesheet and the javascript function to whatever template your blog pages are derived from. The HTML tags will be the same.<\/p>\n<p>And now, your readers will be delighted by their ease of reading and you will be the footnote envy of all of blogdom. <span class=\"ref\"><span class=\"refnum\">[6]<\/span><span class=\"refbody\"> Until someone tells you your page looks crappy on their browser or device. Or blog posts look crazy when they arrive as email. Or&#8230; well, go ahead and tell me. That&#8217;s what the comments are for.<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in February, I implored you to stop using unlinked footnotes in your blog posts. The intrepid Stephen Heard [1] of Scientist Sees Squirrel fame, not the 18th century governor of Georgia pointed out that that linking is a little kludgy. The return anchor can only be at the beginning of a paragraph, so it&#8217;s &hellip; <\/p>\n<p><a class=\"more-link block-button\" href=\"http:\/\/ecologybits.com\/index.php\/2016\/04\/20\/fancy-footnotes-for-the-fearless\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,13],"tags":[],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-explainer","category-technology","nodate"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p77WvP-2E","_links":{"self":[{"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":12,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":176,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/posts\/164\/revisions\/176"}],"wp:attachment":[{"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ecologybits.com\/index.php\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}