Skip to content

Commit ef2ed60

Browse files
authored
Merge pull request #2721 from patternfly/docs/jump-links/fix-demo
docs(jump-links): fix scrollspy demo layout
2 parents bdb2b39 + 38fcdd9 commit ef2ed60

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

elements/pf-jump-links/demo/scrollspy-with-subsections.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h2 id="heading-5">Heading 5</h2>
146146
import '@patternfly/elements/pf-switch/pf-switch.js';
147147
import '@patternfly/elements/pf-jump-links/pf-jump-links.js';
148148

149-
const main = document.querySelector('main');
149+
const main = document.getElementById('demo');
150150
const links = document.querySelector('pf-jump-links');
151151
const swtch = document.querySelector('pf-switch');
152152
const media = matchMedia('(max-width: 600px)');
@@ -159,7 +159,6 @@ <h2 id="heading-5">Heading 5</h2>
159159
const { matches } = media;
160160
const { checked } = swtch;
161161
main.classList.toggle('mobile', matches);
162-
main.classList.toggle('horizontal', !checked);
163162
links.vertical = checked;
164163
links.expandable = matches && checked;
165164
links.centered = !checked;
@@ -213,20 +212,20 @@ <h2 id="heading-5">Heading 5</h2>
213212
padding-inline-start: 48px;
214213
}
215214

216-
&:is(.mobile, .horizontal) {
215+
&.mobile,
216+
&:has(pf-jump-links:not([vertical])) {
217217
grid-template-rows: repeat(auto-fill, auto);
218218
grid-template-columns: 100%;
219219
grid-template-areas:
220220
'head'
221221
'side'
222222
'body';
223-
}
224-
225-
&:is(.mobile, .horizontal) aside {
226-
position: sticky;
227-
top: 0;
228-
box-shadow: rgba(3, 3, 3, 0.16) 0px 4px 4px -4px;
229-
z-index: 1;
223+
& aside {
224+
position: sticky;
225+
top: 0;
226+
box-shadow: rgba(3, 3, 3, 0.16) 0px 4px 4px -4px;
227+
z-index: 1;
228+
}
230229
}
231230
}
232231

0 commit comments

Comments
 (0)