Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using JavaScript and Jquery together with the provided HTML and CSS: Alter the code that introduces the back to top links so that the links

Using JavaScript and Jquery together with the provided HTML and CSS:

Alter the code that introduces the back to top links so that the links only appear after the fourth paragraph.

When a back to top link is clicked, add a new paragraph after the link containing the message You were here. Ensure that the link still works.

When the author's name is clicked, turn it bold (by adding an element, rather than manipulating classes or CSS attributes).

On a subsequent click of the bolded author's name, remove the element that was added (thereby toggling between bold and normal text).

Add a class of inhabitants to each of the chapter's paragraphs without calling .addClass(). Make sure to preserve any existing classes.

HTML:

Flatland

Flatland: A Romance of Many Dimensions

by Edwin A. Abbott

Part 1, Section 3

Concerning the Inhabitants of Flatland

an excerpt

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle, he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered at two hundred and thirty-five; and they have all ended thus.

Read the complete text of Flatland.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CSS:

html, body { margin: 0; padding: 0; }

body { font: 62.5% Verdana, Helvetica, Arial, sans-serif; color: #000; background: #fff; } main { font-size: 1.2em; margin: 10px 2em; }

h1 { font-size: 2.5em; margin-bottom: 0; }

h2 { font-size: 1.3em; margin-bottom: .5em; } h3 { font-size: 1.1em; margin-bottom: 0; }

code { font-size: 1.2em; }

a { color: #06581f; }

/*************************************** Chapter Styles ***************************************/

article { margin-right: 200px; } #f-title { font-size: 1.5em; } #excerpt { font-style: italic; }

span.footnote { font-style: italic; font-family: "Times New Roman", Times, serif; display: block; margin: 1em 0; }

article span.footnote { display: inline; } .text-reference { font-weight: bold; }

#notes { margin-top: 1em; border-top: 1px solid #dedede; } #notes li { margin: 1em 0; }

footer { margin-top: 1em; border-top: 1px solid #dedede; }

.pulled { background: #e5e5e5; position: absolute; width: 120px; top: -20px; right: -180px; padding: 20px; font: italic 1.2em "Times New Roman", Times, serif; }

.rounded-top { background: transparent url(rounded-top.png) no-repeat scroll left top; width: 160px; padding: 20px 0 0 0; } .rounded-bottom { background: transparent url(rounded-bottom.png) no-repeat scroll left bottom; width: 120px; padding: 0 20px 20px 20px; }

.inhabitants { border-left: 5px solid #800; padding-left: 5px; }

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Jquery:

$(document).ready(function() { // Use attr() to add an id, rel, and title. $('article.chapter a[href*="wikipedia"]').attr({ rel: 'external', title: function() { return 'Learn more about ' + $(this).text() + ' at Wikipedia.'; }, id: function(index, oldValue) { return 'wikilink-' + index; } });

// Add "back to top" links. $('back to top').insertAfter('article.chapter p'); $('').prependTo('body');

// Create footnotes. var $notes = $('

    ').insertBefore('#footer'); $('span.footnote').each(function(index) { $(this) .before([ '', '', index + 1, '' ].join('')) .appendTo($notes) .append([ ' (context)' ].join('')) .wrap('
  1. '); });

    // Style pull quotes. $('span.pull-quote').each(function(index) { var $parentParagraph = $(this).parent('p'); $parentParagraph.css('position', 'relative');

    var $clonedCopy = $(this).clone(); $clonedCopy .addClass('pulled') .find('span.drop') .html('…') .end() .text($clonedCopy.text()) .prependTo($parentParagraph) .addClass('rounded-top') .wrapInner('

    '); }); });

    Step by Step Solution

    There are 3 Steps involved in it

    Step: 1

    blur-text-image

    Get Instant Access to Expert-Tailored Solutions

    See step-by-step solutions with expert insights and AI powered tools for academic success

    Step: 2

    blur-text-image_2

    Step: 3

    blur-text-image_3

    Ace Your Homework with AI

    Get the answers you need in no time with our AI-driven, step-by-step assistance

    Get Started

    Recommended Textbook for

    More Books

    Students also viewed these Databases questions

    Question

    What are antidiscrimination laws? What protections do they include?

    Answered: 1 week ago

    Question

    1. Effort is important.

    Answered: 1 week ago