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 - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

index.html

2

package.json
{
"name": "infinite-marquee",
"version": "1.0.5",
"version": "1.0.6",
"description": "Configurable package to create an infinite marquee effect. Animated with JS or CSS.",

@@ -5,0 +5,0 @@ "main": "resources/js/infinite-marquee.js",

import InfiniteMarquee from './infinite-marquee'
const marquee = new InfiniteMarquee()
const marquee = new InfiniteMarquee({ css: false })
// window.addEventListener(

@@ -5,0 +6,0 @@ // 'resize',

@@ -15,3 +15,7 @@ import gsap from 'gsap'

this.fillContainer()
if (this.options.css) {
this.fillContainerCss()
} else {
this.fillContainerJs()
}

@@ -55,3 +59,7 @@ this.animate()

this.fillContainer()
if (this.options.css) {
this.fillContainerCss()
} else {
this.fillContainerJs()
}
}

@@ -70,13 +78,17 @@

// How many content items it takes to fill the container doubled (so animation can loop infinitely)
return Math.ceil(containerWidth / contentWidth) * 2
// How many content items it takes to fill the container (doubled if JS so animation can loop infinitely)
if (this.options.css) {
return Math.ceil(containerWidth / contentWidth)
} else {
return Math.ceil(containerWidth / contentWidth) * 2
}
}
// Create and append DOM
fillContainer() {
// Create and append JS DOM
fillContainerJs() {
const fragment = document.createDocumentFragment()
for (let i = 0; i < this.fillCount; i++) {
const node = this.dom.content.cloneNode(true)
fragment.appendChild(node)
const contentClone = this.dom.content.cloneNode(true)
fragment.appendChild(contentClone)
}

@@ -89,10 +101,28 @@

// Create and append CSS DOM
fillContainerCss() {
const fragment = document.createDocumentFragment()
const innerClone = this.dom.inner.cloneNode()
innerClone.style.setProperty(
'animation-duration',
`${this.options.duration}s`
)
for (let i = 0; i < this.fillCount; i++) {
const contentClone = this.dom.content.cloneNode(true)
innerClone.appendChild(contentClone)
}
fragment.appendChild(innerClone)
fragment.appendChild(innerClone.cloneNode(true))
this.dom.el.innerHTML = ''
this.dom.el.appendChild(fragment)
}
// Create marquee animation
animate() {
if (this.options.css) {
this.dom.inner.style.setProperty(
'animation-duration',
`${this.options.duration}s`
)
this.dom.el.classList.add(

@@ -99,0 +129,0 @@ this.options.direction === 'left' ? 'marquee-left' : 'marquee-right'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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