All Projects → w11k → Angular Sticky Things

w11k / Angular Sticky Things

Licence: mit
Sticky Directive for Angular 2+

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Angular Sticky Things

Elvui
ElvUI for World of Warcraft - The Burning Crusade (2.4.3)
Stars: ✭ 89 (-42.21%)
Mutual labels:  user-interface
Simplified Twitter
Remove distractions from the new Twitter layout. Extension for Chrome, Firefox, Safari, Edge & More
Stars: ✭ 111 (-27.92%)
Mutual labels:  user-interface
Tabler React
React components and demo for the Tabler UI theme.
Stars: ✭ 1,830 (+1088.31%)
Mutual labels:  user-interface
Asf Ui
The official web interface for ASF
Stars: ✭ 100 (-35.06%)
Mutual labels:  user-interface
Shestakui classic
ShestakUI for WoW Classic (1.13.2)
Stars: ✭ 108 (-29.87%)
Mutual labels:  user-interface
Xmouse Controls
Windows utility to enable or disable active window tracking, raising and also the delay in milliseconds. This is known as x-mouse behavior or focus follows mouse.
Stars: ✭ 122 (-20.78%)
Mutual labels:  user-interface
Iced
A cross-platform GUI library for Rust, inspired by Elm
Stars: ✭ 12,176 (+7806.49%)
Mutual labels:  user-interface
Amazing Swift Ui 2019
23 Amazing iOS UI Libraries written in Swift for the Past Year (v.2019)
Stars: ✭ 147 (-4.55%)
Mutual labels:  user-interface
Ezgraver
Simple multi-platform management software for NEJE laser engravers.
Stars: ✭ 108 (-29.87%)
Mutual labels:  user-interface
Torus
Torus is an event-driven model-view UI framework for the web, focused on being tiny, efficient, and free of dependencies.
Stars: ✭ 136 (-11.69%)
Mutual labels:  user-interface
D3 Component
A lightweight component abstraction for D3.js.
Stars: ✭ 105 (-31.82%)
Mutual labels:  user-interface
Horus ui
HorusUI Immediate Mode Graphical User Interface
Stars: ✭ 106 (-31.17%)
Mutual labels:  user-interface
Xamarin.forms.breadcrumb
This is a breadcrumb navigation control that is complete automatic and uses the Navigation stack and page titles to generate the breadcrumbs.
Stars: ✭ 130 (-15.58%)
Mutual labels:  user-interface
Oxtrust
Gluu Server UI for managing authentication, authorization and users.
Stars: ✭ 93 (-39.61%)
Mutual labels:  user-interface
Flutter Tiktok Ui Api Clone
Flutter Tiktok UI API Clone
Stars: ✭ 139 (-9.74%)
Mutual labels:  user-interface
Cheatsheet Of Ui With Fuzzy Behaviors
挙動や仕様が曖昧なユーザインタフェースチートシート
Stars: ✭ 89 (-42.21%)
Mutual labels:  user-interface
Dmitrysengine
[abandoned] C99 cross-platform 3D game engine with absolute minimum of external dependencies
Stars: ✭ 119 (-22.73%)
Mutual labels:  user-interface
Membrane
A platform agnostic clojure(script) library for creating user interfaces
Stars: ✭ 154 (+0%)
Mutual labels:  user-interface
You Dont Know Ui
Learn how to build universal, modern and scalable user interfaces
Stars: ✭ 140 (-9.09%)
Mutual labels:  user-interface
Avalonia
A cross platform XAML framework for .NET
Stars: ✭ 12,588 (+8074.03%)
Mutual labels:  user-interface

npm version

Angular Sticky Things

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

See the demo here.

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

Scroll in Action

Installation

with npm:

npm install @w11k/angular-sticky-things

with yarn:

yarn add @w11k/angular-sticky-things

Now import the AngularStickyThingsModule in the corresponding Module

import {AngularStickyThingsModule} from '@w11k/angular-sticky-things';

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

Usage:

<div #spacer></div>
<div stickyThing [spacer]="spacer">
  I am sticky!
</div>

Boundary Elements

If a boundary element is defined, the sticky element scrolls only within the height of the boundary element and then stops. This is useful if you have multiple sticky elements since it prevents stacking. You can take a look at the examples.

<div #boundary style="height:1000px;">
  <div #spacer></div>
  <div stickyThing [spacer]="spacer" [boundary]="boundary">
    I am sticky but only inside #boundary!
  </div>
</div>

Hint: The boundary feature is still in beta - position errors might occur!

Spacer

The spacer is not required but prevents a page jump when the sticky effect steps in.

Enable

An enable (default true) input can be used to dynamically activate or deactivate the sticky directive (e.g. to have a sticky navbar only in certain conditions). You can take a look at the examples.

<div #spacer></div>
<div stickyThing [spacer]="spacer" [enable]="enableSticky">
  I can become sticky only when enableSticky is true!
</div>

Margins

A marginTop (default 0) input can be used to add some top spacing to the sticky element, in case you don't want it to stick right at the top. It expects the number of pixels you want to use for the space. You can take a look at the examples. Accordingly, marginBottom is available.

<div #boundary style="height:1000px;">
  <div #spacer></div>
  <div stickyThing [spacer]="spacer" marginTop="30">
    I leave 30px of space to the top when I'm sticky!
  </div>
</div>

Event Outputs

<div #boundary style="height:1000px;">
  <div #spacer></div>
  <div stickyThing (stickyPosition)="consoleLog($event)" (stickyStatus)="consoleLog($event)" marginTop="30" marginBottom="50">
    I leave 30px of space to the top when I'm sticky!
  </div>
</div>

Example Output:

[Log] stickyPositon - {offsetY: 786, bottomBoundary: 1406.9999389648438, upperScreenEdgeAt: 75, marginBottom: "50", marginTop: "30"}
[Log] stickyStatus - {isSticky: false, reachedUpperEdge: true, reachedLowerEdge: false}

Scroll in Container

Per default Sticky Things expects your body to be the element that scrolls. However, if Sticky Things is used in an overflow-container, that container must be made known to the directive.

This is best done with a query selector. If a string is provided it will be called with document.querySelector. Instead an HTML element (nativeElement) can be provided as well.

Note: In a scrollable container boundary, spacer and margins don't work.

<div class="scrollable-container">
  <p>I'm special, since my content scrolls and not the body.</p>
  <p>...</p>
  <div stickyThing [scrollContainer]="'.scrollable-container'">Sticky</div>
</div>
.scrollable-container {
  height: 300px;
  margin: 3em auto;
  overflow: scroll;
}

Scroll-Container in Action

Patron

❤️ W11K - The Web Engineers

❤️ theCodeCampus - Trainings for Angular and TypeScript

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].