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

ng-flush

v0.0.10

Published

A simple AngularJS attribute directive that will flush an element to the bottom of its closest positioned parent

Downloads

3

Readme

ng-flush

NPM version Downloads devDependency Status

A simple attribute directive that will flush an element to the bottom of its closest positioned parent (typically the window).

This is not to be confused with a sticky footer, which is easy to implement using CSS.

It is available through NPM:

npm install ng-flush

Usage

Check out the fiddle!

Include flush.min.js in your build or directly with a <script> tag and require the module in your module definition:

angular  
    .module('App', [  
        'flush',  
        ... // other dependencies  
    ]);

To flush an element to the bottom of its closest positioned parent:

<footer flush></footer>

The directive's approach is to set the following inline styles if the element does not naturally reach the bottom:

{
    position: 'absolute';  
    bottom: 0;
}

This means that the element will be flushed to the bottom of its closest positioned parent, regardless of whether it is the window or another element.

The directive will remove the flush styles if the bottom edge of the flushed element would naturally lie below the bottom edge of the parent, meaning that this is not a "sticky footer" (which could be done without JavaScript, using CSS). If the content of the parent is large enough to push the flushed element to the bottom its visible area, the flushed element will position itself naturally.

Typically this is best-used on an element which is the last visible child of its closest positioned parent. Otherwise, the children would appear to the user to change order when the flush is toggled - it would be below its siblings when flushed, and among its siblings when positioned naturally.

Flush triggers

The directive watches the scrollHeight and offsetHeight of the closest positioned parent. If either value changes, the element will be re-flushed.

Note that the directive attempts to use requestAnimationFrame or its browser-specific variants (if they are available) to watch the height values of the parent. This is because using $scope.$watch to keep an eye on the height is not fast enough to catch changes during animations, e.g. expansion and collapse of content within the parent. As a result, there is a slight visual delay when animations cause the parent to change size when $scope.$watch is used. However, since many browsers still do not implement requestAnimationFrame or an equivalent, the directive falls back gracefully and uses $scope.$watch instead when animation functions are not available.