项目介绍

collardeau/svelte-headroom 是一个托管在 GitHub 上的开源项目,主要使用 HTML 编写,目前获得 78 个 Star、9 次 Fork。

仓库全名
collardeau/svelte-headroom
Star 数
78
Fork 数
9
未关闭 Issue
2

README 摘要

Svelte-Headroom Hide your header until you need it! Svelte Headroom is a Svelte component to hide or show your header on scroll, inspired by headroom.js svelte-headroom has no dependencies. Demo Code Sandbox Install npm install svelte-headroom Usage Props offset number The number of pixels from the top of the page before the effect is allowed to occur. The default value is 0. tolerance number The amount of pixels…

完整内容见 GitHub 原始 README 或本页 。

常见问题

svelte-headroom 用什么语言开发?

主要使用 HTML 编写,目前有 78 个 Star。

如何获取 svelte-headroom 的源码?

可以直接克隆仓库:git clone https://github.com/collardeau/svelte-headroom.git,默认分支为 master;安装与运行步骤见仓库 README。

svelte-headroom 最近还在维护吗?

仓库最近一次更新为 2022年2月3日,当前有 2 个未关闭 Issue;Star 数为 78,可作为社区活跃度的参考。

关于

A Svelte component to hide your header on scroll.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
98
价值分
49
活跃状态
活跃

语言占比

HTML
JavaScript

贡献者

README

Svelte-Headroom

Hide your header until you need it!

Svelte Headroom is a Svelte component to hide or show your header on scroll, inspired by headroom.js

svelte-headroom has no dependencies.

Demo

Code Sandbox

Install

npm install svelte-headroom

Usage

<script>
  import Headroom from "svelte-headroom";
</script>

<Headroom>
  <!-- my header -->
</Headroom>

Props

offset number

The number of pixels from the top of the page before the effect is allowed to occur. The default value is 0.


<Headroom offset={50}>
  <!-- my header -->
</Headroom>

tolerance number

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. The default value is 0.


<Headroom tolerance={10}>
  <!-- my header -->
</Headroom>

duration string

The duration of the sliding effect. The value is passed on as a CSS Transition Duration. The default value is "300ms".


<Headroom duration='500ms'>
  <!-- my header -->
</Headroom>

Events

A svelte-headroom component emits two events: pin and unpin.

<Headroom
  on:pin={ () => {} }
  on:unpin={ () => {} }
>
  <header>My Header</header>
</Headroom>

Happy Coding!

评论

暂无评论