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

v1.1.0

Published

Image viewer component for Angular 6+

Downloads

25

Readme

Floating Image Viewer

Mobile look and feel image viewer for Angular 6+

Website: https://qumhieh.github.io/ngx-floating-img/

NGXFloatingImg Demo GIF

Table of contents

Installation

Add ngx-floating-img to your Angular project

npm install --save ngx-floating-img

Once installed import NgxFloatingImgModule.forRoot() in your app.module.ts

import { NgxFloatingImgModule } from "ngx-floating-img";

...
@NgModule({
   ...
   imports: [
    ...
    NgxFloatingImgModule.forRoot(),
    ...
   ],
   ...
})
export class AppModule {}

NgxFloatingImgModule.forChild() for lazy loaded modules

NgxFloatingImgModule.forChild()

Add ngx-floating-img in your template file

<ngx-floating-img ... [options] ... >
    <img src="thumbImgSrc" />
</ngx-floating-img>

Options

| Option | Description | Type | Default | | --- | --- | --- | --- | | id | Component id, can be used as a return value in events handling | string | - | | imgSrc | Full image src | string | - | | imgWidth ( Required ) | Full image width in pixels, if full image not provided then thumb image width | number | - | | imgHeight ( Required ) | Full image height in pixels, if full image not provided then thumb image height | number | - | | imgAnimationType | Image animation type on show and hide | any valid css animation (linear, ease-in ...) | ease-out | | imgAnimationSpeed | Image animation speed on show and hide | any number between 0 (for no animation) and 800 | 250 | | vpPadding | Viewport padding in pixels when full image is visible | number | 20 | | overlayColor | Image overlay background color | color | transparent | | overlayAnimation | Enable / disable fade animation for image overlay | boolean | true | | overlayDismiss | Enable / disable close image on overlay click | boolean | true | | thumbBgColor | Thumb background color | color | #f0f0f0 | | showLoading | Enable / disable loading bar | boolean | true | | loadingColor | Change loading bar background color | color | transparent | | showCloseButton | Show / hide close button | boolean | true | | disableScroll | Enable / Disable page scrolling for desktop browsers only, as it's always disabled for mobile platform to meet the mobile experience | boolean | false |

Default options

Default options can be changed by adding a new object of type NGXFloatingImgOptions when importing NgxFloatingImgModule in your module

NgxFloatingImgModule.forRoot({ imgAnimationSpeed: 200, vpPadding: 30, imgAnimationType: 'linear' })

NGXFloatingImgOptions default values

{
    showLoading: true
    loadingColor: transparent
    imgAnimationType: 'ease-out'
    imgAnimationSpeed: 250
    overlayColor: 'transparent'
    overlayAnimation: true
    overlayDismiss: true
    thumbBgColor: '#f0f0f0'
    vpPadding: 20
    showCloseButton: true
    disableScroll: false
}

Events

| Event | Description | Return | | --- | --- | --- | | beforeShow | This event fires right after thumb click and before animation starts | component id | | afterShow | This event fires after show animation is fully completed | component id | | onFullImgLoad | This event fires after full image is fully loaded (if imgSrc attribute provided) | component id | | beforeClose | This event fires right before close full image process starts | component id | | afterClose | This event fires after closing animation completed | component id |

Examples

https://qumhieh.github.io/ngx-floating-img/examples

Compatibility

- Tested on desktop versions of Chrome, Firefox, Safari, IE10+, Edge.
- Tested on Android and iPhone modern browsers.
- Tested on Ionic 4.

Change log

1.1.0
- Added disableScroll option.
- Improved the user experience on mobile devices.

Bugs

You can report any bugs as Github issues

License

The project is licensed under the MIT license