Home

Awesome

ngx-marquee

@omnedia/ngx-marquee is an Angular library that provides a customizable marquee component with animation controls for scrolling content horizontally or vertically. The component offers flexible configuration options such as animation speed, direction (horizontal or vertical), reverse mode, gap size, and an option to pause the marquee on hover.

Features

Installation

Install the library using npm:

npm install @omnedia/ngx-marquee

Usage

Import the NgxMarqueeComponent in your Angular module or component:

import { NgxMarqueeComponent } from '@omnedia/ngx-marquee';

@Component({
  ...
  imports: [
    ...
    NgxMarqueeComponent,
  ],
  ...
})

Use the component in your template:

<om-marquee
  [reverse]="true"
  [animationDuration]="'10s'"
  [marqueeGap]="'2rem'"
  [pauseOnHover]="true"
  styleClass="custom-marquee"
>
  <div #OmMarqueeContent class="item">
    Item 1
  </div>
  <div #OmMarqueeContent class="item">
    Item 2
  </div>
  <div #OmMarqueeContent class="item">
    Item 3
  </div>
</om-marquee>

How It Works

API

<om-marquee
  [reverse]="reverse"
  [animationDuration]="animationDuration"
  [marqueeGap]="marqueeGap"
  [pauseOnHover]="pauseOnHover"
  [vertical]="vertical"
  styleClass="your-custom-class"
>
  <ng-content></ng-content>
</om-marquee>

Example

<om-marquee [reverse]="false" [animationDuration]="'15s'" [marqueeGap]="'1rem'" styleClass="marquee-container">
  <div #OmMarqueeContent class="marquee-item">Item A</div>
  <div #OmMarqueeContent class="marquee-item">Item B</div>
  <div #OmMarqueeContent class="marquee-item">Item C</div>
</om-marquee>

This will create a marquee that scrolls content horizontally, with an animation duration of 15 seconds and a gap of 1 rem between each item.

Styling

.om-marquee

Example of Global and Custom Styling

In this example, the marquee container is customized with a background color and padding, while the items inside the marquee retain their original styles:

<om-marquee styleClass="marquee-custom-style">
  <div class="item-1" #OmMarqueeContent>News Update 1</div>
  <div class="item-2" #OmMarqueeContent>News Update 2</div>
</om-marquee>

.marquee-custom-style {
  background-color: #333;
  padding: 1rem;
  color: #fff;
}

.item-1 {
  font-size: 1.5rem;
  color: #ffcc00;
}

.item-2 {
  font-size: 1.5rem;
  color: #00ffcc;
}

Contributing

Contributions are welcome. Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.