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

ngx-equalizer

v1.0.2

Published

This library is inspired from [equalizer](https://github.com/skrajewski/Equalizer) jQuery library to keep HTML elements with equal height. The library is compatible with Angular 4+ because of its low peer dependencies.

Downloads

4

Readme

NgxEqualizerDemo

This library is inspired from equalizer jQuery library to keep HTML elements with equal height.
The library is compatible with Angular 4+ because of its low peer dependencies.

Demo: https://raphy.github.io/ngx-equalizer

Install

Using YARN or NPM :

yarn add ngx-equalizer
# or
npm install ngx-equalizer --save

Setup

Just import the NgxEqualizerModule when you need it in a module :

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgxEqualizerModule } from '../../projects/ngx-equalizer/src/lib/ngx-equalizer.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxEqualizerModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Usage

Using the directives

The common usage is using the equalizer and equalize directives:

<div equalizer>
  <div equalize>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ornare bibendum magna at consequat. Morbi ultrices, augue eget condimentum commodo, lacus odio sodales odio, non suscipit libero enim nec odio.
  </div>
  <div equalize>
    Sed lorem elit, bibendum sed varius in, pretium vitae ipsum.<br/>Curabitur vulputate mi risus, vitae pulvinar est egestas quis. Phasellus porta lacus eget velit condimentum, ac iaculis lacus volutpat.
  </div>
  <div equalize>
    Donec quam felis, vulputate non egestas facilisis, sagittis ac odio. Aliquam tincidunt, enim commodo congue volutpat, libero erat tempus massa, eu vehicula risus eros in metus. Etiam convallis, neque quis pellentesque sodales, metus leo gravida magna, dictum ullamcorper metus lectus eget erat. Vestibulum in leo a urna lacinia dapibus a at lacus.
  </div>
</div>

The equalizer directive is the parent and aims to "listen" the equalize children directives.

This way of using the library will automatically update the height of the elements event if the window is resized.

Using the service

A service is provided to equalize an array of ElementRef:

import { ngAfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
import { EqualizerService } from '../../projects/ngx-equalizer/src/lib/equalizer.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements ngAfterViewInit {
  @ViewChild('paragraph1', {read: ElementRef})
  paragraph1: ElementRef;

  @ViewChild('paragraph2', {read: ElementRef})
  paragraph2: ElementRef;

  @ViewChild('paragraph3', {read: ElementRef})
  paragraph3: ElementRef;

  constructor(
    private readonly equalizerService: EqualizerService
  ) {
  }

  ngAfterViewInit(): void {
    this.equalizerService.equalizeElements([
      this.paragraph1,
      this.paragraph2,
      this.paragraph3,
    ]);
  }
}
<div>
  <div #paragraph1>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ornare bibendum magna at consequat. Morbi ultrices, augue eget condimentum commodo, lacus odio sodales odio, non suscipit libero enim nec odio.
  </div>
  <div #paragraph2>
    Sed lorem elit, bibendum sed varius in, pretium vitae ipsum.<br/>Curabitur vulputate mi risus, vitae pulvinar est egestas quis. Phasellus porta lacus eget velit condimentum, ac iaculis lacus volutpat.
  </div>
  <div #paragraph3>
    Donec quam felis, vulputate non egestas facilisis, sagittis ac odio. Aliquam tincidunt, enim commodo congue volutpat, libero erat tempus massa, eu vehicula risus eros in metus. Etiam convallis, neque quis pellentesque sodales, metus leo gravida magna, dictum ullamcorper metus lectus eget erat. Vestibulum in leo a urna lacinia dapibus a at lacus.
  </div>
</div>

This way of using the library will not update the height of the elements event if the window is resized. You have to handle by adding for example:

  @HostListener('window:resize')
  private onWindowResize() {
    this.equalizerService.equalizeElements([
      this.paragraph1,
      this.paragraph2,
      this.paragraph3,
    ]);
  }

License

The project is under MIT License.