-
Notifications
You must be signed in to change notification settings - Fork 107
Chrome
A set of HTML elements used to display the pages of content and UI for display.
<div class="chrome">
<div class="viewer">
</div>
<div class="controls">
<span data-ts-template="position">Page {{pagenumber}} of {{pagecount}}</span>
<button class="prev">Prev</button>
<button class="next">Next</button>
</div>
</div>
The only required component, this element is used as the container for page display. The size of the viewer is used to determine the size used to layout pages. Create the viewer by adding the class viewer
to any element within the chrome.
Certain UI commands can be added automatically to any link or button by adding a CSS class:
-
prev
: Go to the previous page -
next
: Go to the next page -
prevArticle
: Go to the previous article -
nextArticle
: Go to the next article -
menu
: Toggleclass=menu-active
on the root of the Chrome -
open-sidebar
: Addclass=sidebar-active
to the root of the Chrome -
close-sidebar
: Removeclass=sidebar-active
to the root of the Chrome -
toggle-sidebar
: Toggleclass=sidebar-active
on the root of the Chrome
Any element with class=pagewidth
will automatically be made as wide as the initial page shown. This width gets reset whenever a window size change causes a re-layout.
Whenever the user interacts with the page (by moving the mouse or tapping), class=active
will be added to the root of the chrome. This allows authors to show/hide UI elements that should disappear when the user is reading.
These flags can be used to show or hide elements within the Chrome.
Treesaver searches through all Chrome elements from the Resources file, checking each Chrome in markup order until it finds one that:
- Fits in the current screen size, based on the CSS values of
minWidth
,minHeight
,maxWidth
, andmaxHeight
- Meets the Requirements specified by the
data-requires
property
The first Chrome that meets both of these requirements will be selected, and all subsequent chromes will be ignored.