New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

infinite-marquee

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infinite-marquee

Configurable package to create an infinite marquee effect. Animated with JS or CSS.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-84.21%
Maintainers
1
Weekly downloads
 
Created
Source

Infinite Marquee

Configurable package to create an infinite marquee effect. Animated with either CSS or JS.

Installation

npm i infinite-marquee
# or
yarn add infinite-marquee

Basic Usage

Basic Demo

HTML
<div class="marquee">
  <div class="marquee-inner">
    <div class="marquee-content">EXAMPLE</div>
  </div>
</div>
CSS - Add the base styles to your CSS file.

infinite-marquee.css

OR

@import 'infinite-marquee/assets/css/infinite-marquee

Zero Config

import InfiniteMarquee from 'infinite-marquee'

new InfiniteMarquee()

Options

OptionTypeDefaultDescription
elHTMLElementdocument.querySelector('.marquee')Container element.
directionstringleftAnimation direction.
durationnumber5Animation duration in seconds.
cssbooleantrueWhether to animate using CSS. If false GSAP will be used.
disableResizebooleanfalseDisable internal window resize event so an external one can be used.

Methods

MethodDescription
onResizeCall the internal resize method.
updateRecaculate DOM.

Properties

MethodDescription
animationWith {css: false} this will return a GSAP fromTo instance that can be controlled using all of GSAPs methods.

Advanced Usage

Options Demo

Options Example

<div class="marquee my-marquee">
    <div class="marquee-inner">
        <div class="marquee-content">
            EXAMPLE
        </div>
    </div>
</div>
import InfiniteMarquee from 'infinite-marquee'

new InfiniteMarquee({
  el: document.querySelector('.my-marquee'),
  direction: 'right',
  duration: 5,
  css: false
})

Usage with external window resize

For if you would like to batch resizes using an external resize event.

⚠️ I recommend using a debounce on an external resize to maximise performance. Internally this package uses the lodash debounce utility.

import InfiniteMarquee from 'infinite-marquee'

const marquee = new InfiniteMarquee({
  disableResize: true
})

window.addEventListener(
  'resize',
  () => {
    marquee.onResize()
  },
  { passive: true }
)

Notes

⚠️ If your content DOM is modified after load e.g. fonts, images being lazyloaded. Please look into initialising your instance after these have loaded OR calling the update method to recalculate the marquee. Below are some package recommendations that might help with this.

Keywords

FAQs

Package last updated on 07 Nov 2021

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