Skip to content

Commit fc0b4e3

Browse files
committed
feat: updated REPL Demo and added docs for props
1 parent e145838 commit fc0b4e3

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/lib/headroom/index.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
class:hideAtTop
7070
class:showAtBottom
7171
class:hideAtBottom
72-
7372
>
7473
<slot />
7574
</div>

src/routes/+page.svelte

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
<p><strong>Hide your header and footer until you need them!</strong></p>
3737
<p>Svelte Headroom is a <a href="https://svelte.dev" rel="nofollow">Svelte</a> component to hide or show your header on scroll, based on <a href="https://github.com/collardeau/svelte-headroom">collardeau/svelte-headroom</a>, inspired by <a href="https://wicky.nillia.ms/headroom.js/" rel="nofollow">headroom.js</a></p>
3838
<p><code>@taocode/svelte-headroom</code> has <strong>no dependencies</strong>.</p>
39-
<h1>Demo</h1>
40-
<p><a href="https://codesandbox.io/embed/svelte-headroom-demo-cf7lv" rel="nofollow">Code Sandbox</a></p>
41-
<h1>Install</h1>
39+
<h2>Demo</h2>
40+
<p><a href="https://svelte.dev/repl/44cafd471bcf497080e12ed3bee80986" rel="nofollow">SVELTE REPL</a></p>
41+
<h2>Install</h2>
4242
<p><code>npm install @taocode/svelte-headroom</code></p>
4343
<h2>Usage</h2>
4444
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto"><pre>
@@ -57,18 +57,30 @@
5757
<span class="pl-c">&lt;!-- my header --&gt;</span>
5858
<span class="pl-kos">&lt;/</span><span class="pl-ent">Headroom</span><span class="pl-kos">&gt;</span></pre></div>
5959
<h3><code>tolerance</code> number</h3>
60-
<p>The amount of pixels that need to be scrolled in either direction for the effect to occur. This is useful if you want the user to be able to scroll slowly and not change the header position. Default: <code>0</code>.</p>
60+
<p>The number of pixels that need to be scrolled in either direction for the effect to occur. This is useful if you want the user to be able to scroll slowly and not change the header position. Default: <code>0</code>.</p>
6161
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto"><pre>
6262
<span class="pl-kos">&lt;</span><span class="pl-ent">Headroom</span> <span class="pl-c1">tolerance</span>=<span class="pl-s">&lbrace;10&rbrace;</span><span class="pl-kos">&gt;</span>
6363
<span class="pl-c">&lt;!-- my header --&gt;</span>
6464
<span class="pl-kos">&lt;/</span><span class="pl-ent">Headroom</span><span class="pl-kos">&gt;</span></pre></div>
65+
<h3><code>shim</code> number</h3>
66+
<p>The number of pixels from top or bottom to detect top or bottom status. If you're within this value of top or bottom, you'll be considered at top or bottom. Default: <code>2</code>.</p>
67+
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto"><pre>
68+
<span class="pl-kos">&lt;</span><span class="pl-ent">Headroom</span> <span class="pl-c1">shim</span>=<span class="pl-s">&lbrace;5&rbrace;</span><span class="pl-kos">&gt;</span>
69+
<span class="pl-c">&lt;!-- my header --&gt;</span>
70+
<span class="pl-kos">&lt;/</span><span class="pl-ent">Headroom</span><span class="pl-kos">&gt;</span></pre></div>
6571
<h3><code>duration</code> string</h3>
6672
<p>The duration of the sliding effect. The value is passed on as a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transition-duration" rel="nofollow">CSS Transition Duration</a>. Default: <code>"300ms"</code>.</p>
6773
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto"><pre>
6874
<span class="pl-kos">&lt;</span><span class="pl-ent">Headroom</span> <span class="pl-c1">duration</span>='<span class="pl-s">500ms</span>'<span class="pl-kos">&gt;</span>
6975
<span class="pl-c">&lt;!-- my header --&gt;</span>
7076
<span class="pl-kos">&lt;/</span><span class="pl-ent">Headroom</span><span class="pl-kos">&gt;</span></pre></div>
7177

78+
<h3><code>easing</code> string</h3>
79+
<p>The easing of the sliding effect. The value is passed on as a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function" rel="nofollow">CSS Transition Timing Function</a>. Default: <code>"linear"</code>.</p>
80+
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto"><pre>
81+
<span class="pl-kos">&lt;</span><span class="pl-ent">Headroom</span> <span class="pl-c1">easing</span>='<span class="pl-s">ease-out</span>'<span class="pl-kos">&gt;</span>
82+
<span class="pl-c">&lt;!-- my header --&gt;</span>
83+
<span class="pl-kos">&lt;/</span><span class="pl-ent">Headroom</span><span class="pl-kos">&gt;</span></pre></div>
7284

7385
<h3><code>bottom</code> boolean</h3>
7486
<p>If this is to be pinned to the bottom, like a return to top button. Default: false.</p>

0 commit comments

Comments
 (0)