on your main page with a class of 'article-container' In this case, you would set this option to 'article.article-container' (or an equivalent CSS selector). Leaving the option undefined will simply number all footnotes on a given page sequentially.Default:
undefined$3
If any truthy value is provided, only the footnotes within the scope you define will be affected by the script. The scope should be a selector string, as you would typically use in jQuery. For example, setting a scope of
'.littlefoot-active' would work only on those elements with an ancestor that has a class of littlefoot-active.Default:
undefined$3
A template for the markup of the footnote content popovers. It's best not to change this too much; the library relies on the class names and hierarchy of the default markup to do its work. However, you can add information to the rendered markup by adding string literals or one or more of the following variables:
-
content: The HTML markup of the original footnote.
- number: The footnote number (sequential ordering of all footnotes within an element matching the numberResetSelector option).
- id: The footnote identifier (sequential ordering of all footnotes on the page, starting from 1).Variables should be added between interpolation delimiters. For example,
<% content %>.Default:
`html
alt="Footnote <% number %>"
class="littlefoot__popover"
id="fncontent:<% id %>"
>
<% content %>
`$3
A template for the markup of the footnote button. Again, try not to remove any elements from the markup, but add as much as you like.
-
content: The escaped HTML markup of the original footnote.
- id: The footnote identifier (sequential ordering of all footnotes on the page, starting from 1).
- number: The footnote number (sequential ordering of all footnotes within an element matching the numberResetSelector option).
- reference: The footnote reference used to populate the ID attribute.Variables should be added between interpolation delimiters. For example,
<% content %>.Default:
`html
class="littlefoot__button"
id="<% reference %>"
title="See Footnote <% number %>"
>
role="img"
aria-labelledby="title-<% reference %>"
viewbox="0 0 31 6"
preserveAspectRatio="xMidYMid"
>
Footnote <% number %>
`#### Numerical footnotes
To display the footnote number instead of an ellipsis, provide the following
buttonTemplate instead:`html
aria-label="Footnote <% number %>"
class="littlefoot__button"
id="<% reference %>"
title="See Footnote <% number %>"
/>
<% number %>
`Methods
Running the function will return an object that can be stored and used to manipulate the footnote buttons/content. The following methods are available in this return object:
$3
This function will close the popover matching the footnote ID. If omitted, all popovers are dismissed.
timeout specifies the amount of time after the footnote's active class is removed before the element itself is removed. If excluded, timeout will default to the dismissDelay option.$3
This will activate the footnote button (and its associated popover) matching the
footnote ID.
timeout specifies the amount of time before the footnote's active
class is applied. If excluded, timeout will default to the activateDelay
option.$3
Returns the instance setting matching the provided string key.
$3
Updates the littlefoot instance settings for the provided string key with a new
value.
$3
This will disable littlefoot and restore the document to its original structure,
clearing event handlers. Once
unmount() is called, all other methods provided
in the littlefoot instance will stop working, requiring you to call the
littlefoot() function again.Theming
littlefoot supports theming through CSS custom properties. The following custom properties are available in browsers or CSS precompilation tools that support them, and are scoped to the
.littlefoot class.$3
Customise littlefoot's appearance by overriding its custom properties in your site's CSS, like so:
`css
.littlefoot {
--button-active-background-color: #d2b450;
--button-text-color: #fff;
}
`$3
| Button properties | Default value | Purpose |
| :--------------------------------- | :---------------------------------------------- | :------------------------------ |
|
--button-background-color | #949494 | Button background color. |
| --button-active-background-color | #4c4c4c | Active button background color. |
| --button-border-radius | 0.5rem | Button border radius. |
| --button-active-text-color | #fafafa | Active button text color. |
| --button-height | 1rem | Button height. |
| --button-margin | 0 0.1rem | Button margin. |
| --button-padding | 0 0.6rem | Button padding |
| --button-text-color | #fafafa | Button text color. |
| --button-transition | background-color 0.25s ease, color 0.25s ease | Button transition animation. |$3
| Popover properties | Default value | Purpose |
| :--------------------------------- | :----------------------------------------- | :------------------------------ |
|
--popover-background-color | #f5f5f5 | Popover background color. |
| --popover-border-radius | 0.5rem | Popover border radius. |
| --popover-border | 1px solid #949494 | Popover border. |
| --popover-font-family | initial | Popover text font family. |
| --popover-font-size | initial | Popover text font size. |
| --popover-font-style | initial | Popover text font style. |
| --popover-font-weight | initial | Popover text font weight. |
| --popover-horizontal-padding | 1.4rem | Popover horizontal padding. |
| --popover-line-height | normal | Popover text line height. |
| --popover-max-height | 15em | Maximum popover height. |
| --popover-max-width | 90% | Maximum popover width. |
| --popover-scroll-indicator-color | #4c4c4c | Popover scroll indicator color. |
| --popover-shadow | 0 0 8px rgba(0, 0, 0, 0.3) | Popover drop shadow. |
| --popover-text-color | #111 | Popover text color. |
| --popover-tooltip-size | 0.5rem | Popover tooltip size. |
| --popover-transform-origin | 50% 0 | Popover transform origin. |
| --popover-transform | scale(0.1) translateZ(0) | Initial popover transform. |
| --popover-active-transform | scale(1) translateZ(0) | Activated popover transform. |
| --popover-transition | opacity 0.25s ease, transform 0.25s ease | Popover transition animation. |
| --popover-vertical-padding | 0.6rem | Popover vertical padding. |
| --popover-width | 22em` | Popover width. |$3
Browsers that don't support CSS custom properties will receive the default values. The appearance of elements may still be overridden through normal CSS definitions as in previous versions of littlefoot.
Changes from Bigfoot.js
Consult the changelog.
License
MIT © Chris Sauvé and Luís Rodrigues.
