-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
A selector targeting anchor tags in some kind navigations.
type: string
default: "nav a"
Class name that will be added on anchor if section was reached
type: string
default: active
Class name that will be added on section when reached
type: string
default: active
A distance from the top of page, that the next element must be scrolled to in order to be activated. Value given in precents (0-100)% - default (50)
type: number
default: 50
A selector to element, which obtain class active, if none section was reached or none is active while using exactMatch
option.
type: string
default: undefined
behavior: on undefined, first link in array will be set as active
Indicates if anchor tags should become active
class.
type: boolean
default: true
Determines whether first link element should be set as active if no section reached.
May be combined with exactMatch
option and/or defaultActiveElement
option, to set other element to become class instead of first link.
type: boolean
default: true
Indicates whether the element with a matching ID should have the active class added to it when it is reached.
type: boolean
default: false
Value will change into undefined if offset isn't exactly in some of section - it means, you can clear hash or active class if target offset find itself between important sections.
You can use saveHashBetweenSections
, to behave last section hash, but clear active class from nav link.
type: boolean
default: false
Updates hash accordingly to section. Might be combined with exactMatch
option, and need to be activated to saveHashBetweenSections
property makes any
type: string
default: false
Automatically take last seen section id as hash, if current offset doesn't match any section.
conditions: updateHash
and exactMatch
options has to be set to true. Then if this value will be set to false, hash will be empty if offset doesn't match any section.
type: boolean
default: true
Array of selectors for closest parent elements, where class 'active' should be added or removed when section changes
type: array with selectors
default: []
Example usage to set classes on closest li and nav element
{
parentsObtainingActiveClass = ["li", "nav"]
}
Array with paths, where script will be evaluated. Path will be evaluated with match
function. You can use some of useful regexes below to enclose script only to one particular site or sites set.
type: array of regex
default: []
Useful regexes:
-
^[^/]*/$
- use it to let script working only on root page -"/"
-
^/demo/$
- use to match exact site e.g. -"/demo/"
-
^/demo/
- use to match demo and all subsites, which path begins with 'demo' e.g. -"/demo/subsite/..."
Array of functions, that should be fired when section changes. Callback function receives onePageNav object: callback(onePageNavObject)
type: array
default: []
Shows debug accordingly to offset in changeOffset option
type: string
default: false
These properties are present at object passed into onChange callback,
Keeps active section after change.
Keeps active section before change.
Keeps all links matched to navLinksSelector value.
Array with all sections matched to navLinks.
Element that has been matched with defaultActiveElement
selector.
If you want to check, where section finds itself accordingly to current offset, use Class Offset.(documentation not fully )