Skip to content

Commit

Permalink
fixed 'scrollToPath()' documentation and example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrin9 committed Oct 2, 2024
1 parent e7c13e1 commit cb8505d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ <h2> Methods </h2>
<td> <a href="https://github.com/rapi-doc/RapiDoc/blob/master/docs/examples/example9.html"> Example </a></td>
</tr>
<tr id="scrollTo">
<td class="mono bold right">scrollTo(path) </td>
<td class="mono bold right">scrollToPath(path) </td>
<td class="gray" colspan="2">
To programmatically scroll to a section (identified by combination method and path).
<br/>
Expand Down
19 changes: 10 additions & 9 deletions docs/examples/collapsable-focused.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,36 @@

function scrollWithAPI() {
let docEl = getRapiDoc();
docEl.scrollTo("get-/closed");
docEl.scrollToPath("get-/closed");
}
</script>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<script type="text/javascript" src="../rapidoc-min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap" rel="stylesheet">
<link href='../index.css' rel='stylesheet'>
</head>
<body>
<rapi-doc
id="thedoc"
spec-url="../specs/collapsable.yaml"
show-header = "false"
mono-font = "Roboto Mono"
regular-font = 'Open Sans'
allow-authentication = "false"
allow-server-selection = "false"
show-info = "true"
render-style= "focused"
>

<div style="padding:16px; display: flex;justify-content: center; align-items: center;">
<span>Use</span> <span class='mono' style="margin: 0 5px;">scrollTo()</span> <span> method to goto : </span>
<button class="btn normal" onclick="document.getElementById('thedoc').scrollTo('overview')">
<span>Use</span> <span class='mono' style="margin: 0 5px;">scrollToPath(path:string)</span> <span> method to goto : </span>
</div>
<div style="padding:16px; display: flex;justify-content: center; align-items: center;">
<button class="btn normal" onclick="document.getElementById('thedoc').scrollToPath('overview')">
Overview
</button>
<button class="btn normal" style="width:190px" onclick="document.getElementById('thedoc').scrollTo('get-/path1-in-closed-tag')">
<button class="btn normal" style="width:190px" onclick="document.getElementById('thedoc').scrollToPath('get-/path1-in-closed-tag')">
valid path (in collapsed tag)
</button>
<button class="btn normal" style="width:140px" onclick="document.getElementById('thedoc').scrollTo('an-incorrect-path')">
<button class="btn normal" style="width:140px" onclick="document.getElementById('thedoc').scrollToPath('an-incorrect-path')">
non-existant path
</button>
</div>
Expand Down

0 comments on commit cb8505d

Please sign in to comment.