npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-scroll-animations

v1.1.3

Published

This library implements element animations that are triggered by or control user scroll.

Downloads

15

Readme

Angular Scroll Animations Library

This library implements element animations that are triggered by or control user scroll.

Features

  • Animate on scroll: Simple directive that adds a class (CSS animation) to an element
  • Scroll to section: Service that smooth scrolls the user to an element of the website based on the element's HTML id

Demo

Demo Application

Installation

$ npm install angular-scroll-animations

Add the following to you module (app.module.ts)

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
...
...
import { AppComponent } from './app.component';

// Import Angular Scroll Animations Module
import { AngularScrollAnimationsModule } from "angular-scroll-animations";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Add module to imports list
    AngularScrollAnimationsModule
  ],
  providers: [...]
})
export class AppModule { }

Usage Instructions

Animation trigger on scroll:

  • In template (.html):
<div animateOnScroll startAnimation="faded-out" endAnimation="released" [scrollOffset]="50" [timeOffset]="10">
  • Add animateOnScroll directive attribute to enable functionality (required)
  • startAnimation attribute is the CSS class name of the prior state (required)
  • endAnimation attribute is the CSS class name of the final state after animation (required)
  • scrollOffset attribute is the offset from the intersection between the bottom of the screen and the element start
  • timeOffset attribute is the time delay after hitting intersection point

Animate scroll to section:

  • In template (.html):
<button (click)="scrollToSection(1)">Scroll To Section 1</button>
<section id="sec-1">
</section>
  • In typescript (.ts)
constructor(private scrollControl: ScrollControlService) {}

ngOnInit(): void {
  // Initialize polyfill
  this.scrollControl.scrollToSectionPolyInit();
}

public scrollToSection(n: number): void {
  this.scrollControl.scrollToElement("sec-" + n);
}
  • Add a native id attribute to any element (required)
  • Use dependency injection to inject the ScrollControlService into the component (required)
  • Create a method that calls the scrollToElement method on the service (required)
    • The scrollToElement method takes a string argument of the HTML id of the element to scroll to
  • Initialize lazy-loaded polyfills for smooth scrolling behavior in ngOnInit(). Reference above code.
    • This polyfill is optional, but can be lazy loaded to support older browsers and Safari

Author

SimpleCore: https://simplecore.org

KataniaAI

CoreClassroom

MyLanguageJournal

Repository

GitHub NPM