12.1.0 • Published 3 years ago

ngx-aspect-ratio v12.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Description

Angular component container that maintains aspect ratio when responsive or changing the width of the parent. Convenient to use for inserting videos, photos or other content for which you need to maintain aspect ratio.

Demo

Installation

$ npm install ngx-aspect-ratio

Add the module to your application

@Module({
  imports: [
    NgxAspectRatioModule,
  ],
})
export class AppModule {
}

Usage

<ngx-aspect-ratio aspectRatio="4:3">
  <!-- your content-->
</ngx-aspect-ratio>

Properties

PropTypeDescription
aspectRatiostringAspect ratio in format number:/number. For example 4: 3 or 16/9
heightPercentnumberThe height of the container as a percentage of the width of the container. Set automatically when using aspectRatio