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-img-zoom

v4.1.2

Published

## Project status

Downloads

1,571

Readme

ngx-img-zoom

Project status

Still in early development, more features are planned and incoming. Should be in a working state right now but it's not tested in lots of different setups yet.

Demonstration of available features available here.

About

ngx-img-zoom is inspired by angular2-image-zoom and JQuery libraries such as jQuery Zoom and elevateZoom-plus but a pure Angular2+ implementation of similar concepts. Also it has Angular Universal support too.

Available options

Option | Default value | Description | Example value :---:|:---:|:---:|- zoomImageSrc | none | (Required) Image that should appear in zoom window. | 'https://www.myimage.com/imagename.jpg' previewImageSrc | none | (Required) Image to appear in the preview window. | 'https://www.myimage.com/imagename.jpg' imgStyle | "'width:300px; height:300px'" | CSS Style for the main image container | "'width:400px; height:400px'" resultStyle | "'width:300px; height:300px'" | CSS Style for the result container. Here result is a new window that appears only when you hover over the image | "'width:400px; height:400px'" lensStyle | "'width:30px; height:30px'" | CSS Style for the lense. It appers only on top of the main image when you hover over it | "'width:40px; height:40px'" enableZoom | false | To enable zoom | "true" containerStyle | 'position: absolute' | CSS Style for the container that holds all the 3 elements mentioned above | "'width:400px; height:400px'"

Installation

To install this library, run:

$ npm i ngx-img-zoom --save

Zoom Feature

New version supports zooming functionality. To enable this, you have to set enableZoom input property as true. Also you have to set size of lens for each step of the scroll and in the order you want. Refer to the example below for further details.

Using this library

From your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { NgxImageZoomModule } from 'ngx-img-zoom';

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

Once the library is imported, you can use its component in your Angular application:

<!-- You can now use ngx-img-zoom component in app.component.html -->
<h1>
  {{title}}
</h1>
<ngx-img-zoom
    [zoomImageSrc]="zoomImageSrc"
    [previewImageSrc]="previewImageSrc" 
    [imgStyle]="'width:515px; height:515px; bottom:0;  left:0;  right:0;  top:0;  margin:0 auto; border:1px solid #dcdcdc;'" 
    [resultStyle]="`width:824px; height:824px; background-repeat: no-repeat; z-index: 2; position:absolute;
                   -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
                    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); top: 0;left: 100%;`"
    [lensStyle]="'width:155px; height:155px"
    [enableZoom] = "enableZoom"
    [containerStyle]=""
></ngx-img-zoom>
import { NgxImgZoomService } from 'ngx-img-zoom';
import { Component } from '@angular/core';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  enableZoom: Boolean = true;
  previewImageSrc = 'pathToImage';
  zoomImageSrc = 'pathToImage';

  constructor(private ngxImgZoom: NgxImgZoomService) {
    this.ngxImgZoom.setZoomBreakPoints([{w: 100, h: 100}, {w: 150, h: 150}, {w: 200, h: 200}, {w: 250, h: 250}, {w: 300, h: 300}]);
  }
}

License

MIT © Tibin Thomas