Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-floating-img

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-floating-img

Image viewer component for Angular 6+

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

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

OptionDescriptionTypeDefault
idComponent id, can be used as a return value in events handlingstring-
imgSrcFull image srcstring-
imgWidth ( Required )Full image width in pixels, if full image not provided then thumb image widthnumber-
imgHeight ( Required )Full image height in pixels, if full image not provided then thumb image heightnumber-
imgAnimationTypeImage animation type on show and hideany valid css animation (linear, ease-in ...)ease-out
imgAnimationSpeedImage animation speed on show and hideany number between 0 (for no animation) and 800250
vpPaddingViewport padding in pixels when full image is visiblenumber20
overlayColorImage overlay background colorcolortransparent
overlayAnimationEnable / disable fade animation for image overlaybooleantrue
overlayDismissEnable / disable close image on overlay clickbooleantrue
thumbBgColorThumb background colorcolor#f0f0f0
showLoadingEnable / disable loading barbooleantrue
loadingColorChange loading bar background colorcolortransparent
showCloseButtonShow / hide close buttonbooleantrue
disableScrollEnable / Disable page scrolling for desktop browsers only, as it's always disabled for mobile platform to meet the mobile experiencebooleanfalse

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

EventDescriptionReturn
beforeShowThis event fires right after thumb click and before animation startscomponent id
afterShowThis event fires after show animation is fully completedcomponent id
onFullImgLoadThis event fires after full image is fully loaded (if imgSrc attribute provided)component id
beforeCloseThis event fires right before close full image process startscomponent id
afterCloseThis event fires after closing animation completedcomponent 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

Keywords

FAQs

Package last updated on 03 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc