戴莫: https://ngx-headroom.netlify.com/ 互联网档案馆的存檔,存档日期2013-12-22
角组件来隐藏/显示滚动上的标题 。 港口 反应室 由Kyleamathews 制作, 围绕 会议室.js
固定头对持续导航是不错的,但也可以通过占用宝贵的垂直屏幕空间来阻拦. 使用此组件, 您可以在不需要导航时保留屏幕空间的同时, 保留您的持续导航 .
依赖关系
每个版本的最新版本
| ngx-前厅 | 角质 |
|---|---|
| 2.3.2 | 6.x 7.x (中文(简体) ) |
| 3.0.3 信息技术 | 8.x 9.x (中文(简体) ) |
| 4.0.0 (单位:千美元) | 10.x 11.x (英语) |
| 当前 | >= 12.x |
安装
npm install @ctrl/ngx-headroom
使用角头室
导入模块 。 要求数 @angular/animations
// requires BrowserAnimationsModule
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
// import HeadroomModule
import { HeadroomModule } from '@ctrl/ngx-headroom';
使用模块
<ngx-headroom>
<h1>You can put anything you'd like inside the Headroom Component</h1>
</ngx-headroom>
覆盖动画
组件是用来插上"n play"的 意思是 它有合理的默认 用于动画头的进出。 如果你想推翻默认的动画.
通过传递自己的数值来覆盖动画默认值
<ngx-headroom duration="500" easing="ease-in-out">
<h1>You can put anything you'd like inside the Headroom Component</h1>
</ngx-headroom>
投入
duration- 动画持续时间以毫秒计easing- 简化动画upTolerance——在组件被粘住前滚动时用px滚动可容忍性downTolerance——当组件被固定前向下滚动时,在px中滚动容积disable——禁用接线和取消接线wrapperStyle——通过包装div的样式(这保持了页面上方的组件垂直空间).parent——为滚动事件提供自定义的"家长"元素.parent职能应是解决所需因素.pinStart高度在px中,其中头部应该开始并停止打针. 当您在主室组件上方有另一个元素时有用 .
产出
pin- 封住头部时发射unpin- 当信头被钉住时发射unfix- 当信头位置不再固定时发射
GitHub 图像 @scttcper (英语) • 妇女 微博 @scttcper (英语)