You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: fixed offset to work more reliably and added some docs (#908)
* fixed offset to work more reliably and added some docs
* fixed silly mistake
* cleaned up a bit
* removed duplicated header
* changed selector to find the right element
* removed unnecessary check
* added support for using a css variable for offset
* some small performance and best practices fixed, added support for stylesheets to determine offset
* updated readme to have more about offset and the new css feature
* adding an offset attribute observer
* removing some console logs
* fixing some if else logic
* adding additional tests
* adding a couple of enhancements to the demo file
* switching from --pfe-jump-links-nav--offset to --pfe-jump-links-panel--offset
We agreed that it makes more sense to have the offset on the panel instead of the nav since the panel is watching for scroll events.
* Update elements/pfe-jump-links/README.md
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/README.md
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/README.md
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/src/pfe-jump-links.js
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/src/pfe-jump-links.js
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/src/pfe-jump-links.js
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/src/pfe-jump-links.js
Co-authored-by: [ Cassondra ] <[email protected]>
* Update elements/pfe-jump-links/src/pfe-jump-links.js
Co-authored-by: [ Cassondra ] <[email protected]>
* updating components with pfe-c prefixes
Co-authored-by: Daniel Faucette <[email protected]>
Co-authored-by: Kendall Totten <[email protected]>
Co-authored-by: Kyle Buchanan <[email protected]>
Co-authored-by: [ Cassondra ] <[email protected]>
Copy file name to clipboardExpand all lines: elements/pfe-jump-links/README.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,11 +69,20 @@ No extra roles or aria labels are required because we're using standard html tag
69
69
70
70
## Slots
71
71
72
-
-`namedSlot`: The only slot this component has is the heading. The rest of the component works by creating a mirror shadowRoot based on the Light DOM markup.
72
+
73
+
-`pfe-jump-links-nav--heading`: The rest of the component works by creating a mirror shadowRoot based on the Light DOM markup.
74
+
73
75
74
76
## Attributes
75
77
76
-
-`attr`: autobuild Flips the switch on the component to create its own markup for the navigation. If you use this attribute, then no experience is given for non-JS runtimes and the component will crawl the associated panel to come up with its own list of links.
78
+
79
+
-`pfe-c-autobuild`: Flips the switch on the component to create its own markup for the navigation. You can add `pfe-jump-links-panel__section` to each section that should show in the nav. If you want to use sub-sections add `has-sub-section` to the parent section that should always show and the `sub-section` class to the children of that section. If you use this attribute, keep in mind that non-JavaScript environments (some search engines, browsers with JS disabled) will not see the proper markup.
80
+
81
+
-`sr-text`: This attribute is read when the component upgrades to provide the innerText of the heading. If there is no `sr-text` attribute then the component defaults to "JUMP TO SECTION". This attribute is to enable translations and internationalization.
82
+
83
+
-`pfe-c-offset`: This attribute determines the distance from the top of the browser window to trigger a switch from one link being active to the next. For instance `pfe-c-offset="600"` would mean that threshold flips at 600px from the top. The default is set at 200, and if you desire 200px then you can leave this attribute off. The `pfe-c-offset` attribute should be placed on `pfe-jump-links-panel`. There is a css solution to control the offset, however the attribute value takes precedence over css. To read more about a css solution see below.
84
+
85
+
-`style="--pfe-jump-links-panel--offset: {integer};"`: You can control offset in your styling layer as well. This value can be set directly on the component inside a style attribute, e.g. `style="--pfe-jump-links-panel--offset: 100;"` or using the appropriate selector in another file. Please note that adding an attribute will take precedence over a css value. At the moment only integer values passed to this key are valid. No other values are supported. This means that passing "300px", "2rem","calc(100% - 12px)" will all result in JavaScript errors. You should pass a number that correlates to pixels. To read about the `pfe-c-offset` attribute, see above.
77
86
78
87
## Events
79
88
This component fires an event when a link is made active.
0 commit comments