@enten/ngx-sticky

中文文档
17.0.0发布于 2024/05/05MITTypeScriptES Module近 30 天下载 2250
原始使用文档
文档目录7 节
  1. Requirements
  2. Features
  3. Installation
  4. Usage
  5. Showcases
  6. Thanks to
  7. License

@enten/ngx-sticky

NPM Version CI-CD Coverage Status NPM bundle size License: MIT

:warning: WIP

An Angular directive for making things sticky when the user scrolls (for Angular 2+) with no jQuery Dependency.

Requirements

  • Angular (requires Angular 4.x or higher)
  • Supports all major browsers and IE11 and up (lower versions might not be supported)

Features

  • Stick all the things!
  • Super smooth!
  • Tested in real world projects
  • Support for Angular Universal
  • Prevents page-jumping when switching to sticky mode
  • No jQuery or other dependencies - pure Angular solution
  • Support for boundaries to make elements stop

Installation

with npm:

npm install @enten/ngx-sticky

with yarn:

yarn add @enten/ngx-sticky

Now import the NgxStickyModule in the corresponding Module

import { NgxStickyModule } from '@enten/ngx-sticky';

@NgModule({
  declarations: [
  ],
  imports: [
    NgxStickyModule,
  ],
  providers: [],
})
export class SomeModule { }

Usage

<div ngxSticky>
  I am sticky!
</div>

Showcases

@enten/ngx-sticky@angular/corerxjs
17.0.0^17.0.0^6.5.3 || ^7.4.0
16.0.0^16.0.0^6.5.3 || ^7.4.0
15.0.0^15.0.0^6.5.3 || ^7.4.0
14.0.0^14.0.0^6.5.3 || ^7.4.0
13.0.0^13.0.0^6.5.3 || ^7.4.0
12.0.0^12.0.0^6.5.3 || ^7.0.0
11.0.0^11.0.0^6.5.3
10.0.0^10.0.0^6.5.3
9.0.0^9.0.0^6.5.3
8.0.0^8.0.0^6.4.0
7.0.0^7.0.0>=6.0.0 <6.4.0
6.0.0^6.0.0>=6.0.0 <6.4.0

Thanks to

License

MIT

版本与发布记录

@enten/ngx-sticky 共发布 27 个版本,首次发布于 2019/02/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
17.0.0latest2024/05/052 年前
16.0.02023/10/113 年前
15.0.02023/10/113 年前
14.0.02023/10/113 年前
13.0.02023/10/113 年前
12.0.02023/10/113 年前

其他发布通道:ng11 → 11.0.0,ng6 → 6.0.0,ng7 → 7.0.0,ng8 → 8.0.0,ng9 → 9.0.0,ng10 → 10.0.0。

关于 @enten/ngx-sticky 的常见问题

@enten/ngx-sticky 是什么?

[](https://github.com/enten/ngx-sticky/actions/workflows/m

如何安装 @enten/ngx-sticky?

在项目目录运行 npm install @enten/ngx-sticky,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(^17.0.0)、rxjs(^6.5.3 || ^7.4.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@enten/ngx-sticky 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@enten/ngx-sticky 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@enten/ngx-sticky 可以商用吗?

@enten/ngx-sticky 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@enten/ngx-sticky 的下载量有多少?

根据 npm 官方下载统计,@enten/ngx-sticky 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,250 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@enten/ngx-sticky 还在维护吗?

最新版本 17.0.0 发布于 2024/05/05(2 年前);至今共发布 27 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/02/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。