Utils for setting, storing, and restoring scroll position
- Source:
- position.js
Properties:
Name | Type | Description |
---|---|---|
stack |
array | Undo stack of scroll positions |
fwdstack |
array | Redo stack of scroll positions |
lastID |
object | Object containing { loc: {number}, title: {string} } |
initted |
boolean | Flag set after initialization |
Requires
Methods
-
backwards()
-
Restore position backward in stack (undo)
- Source:
- position.js
-
fetchHTML()
-
Get the HTML contents of the TOC
- Source:
- toc.js
Returns:
HTML contents of the TOC
- Type
- string
-
forwards()
-
Restore position forward in stack
- Source:
- position.js
-
idProximity( [back])
-
Get proximity to nearest element with ID
Parameters:
Name Type Argument Default Description back
boolean <optional>
false Flag to force moving backward (up) in document
- Source:
- position.js
Returns:
Object with {loc: {x,y}, title: {string}}
- Type
- object
-
init()
-
Initialize scroll stack and store current position
- Source:
- position.js
Returns:
[x offset, y offset]
- Type
- array
-
move(position)
-
Move the table of contents into doc for printing
Parameters:
Name Type Description position
number | string If position is "top" or 0, clone the TOC to top or location of TOC tag in document
- Source:
- toc.js
-
push()
-
Push current position to stack in memory
- Source:
- position.js
Returns:
[x offset, y offset]
- Type
- array
-
restore(force)
-
Restore last position
Parameters:
Name Type Description force
boolean Force restore
- Source:
- position.js
Returns:
[x position, y position]
- Type
- array
-
restoreProximity()
-
Restore scroll position to nearest saved proximity
- Source:
- position.js
-
saveProximity()
-
Save proximity to nearest element with ID
- Source:
- position.js
-
store()
-
Store current position to Cocoa object
- Source:
- position.js
Returns:
[x offset, y offset]
- Type
- array