Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn in Year 5 - @114.36
Five Stars Random | Recent Posts | Guild Recents
News: :4u: ~~~~~~~~~~~ Guild Events: weekly zine theme 12: television

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  CSS/Javascript infinite marquee is chopped and repeats when finish


« previous next »
Pages: [1] Print Embed
Author Topic: CSS/Javascript infinite marquee is chopped and repeats when finish  (Read 519 times)
Valery_04
Casual Poster ⚓︎
*
View Profile WWW


Zero's girlfriend
⛺︎ My Room

Guild Memberships:
Artifacts:
Nightrave (MMXOC, 8 bits)Joined 2026!
« on: Summer in Year 5 @888 » Embed

I need help with the marquees on my homepage. They look this way and when they go to the limit they start from 0% again. I want them similar to the 'marquee' HTML tag because the landing page made that tag not move anymore.

Page: Valkyria's Hideout

https://file.garden/aTyH7uSsXSbubAjB/Capturadt.PNG

Logged

https://file.garden/aTyH7uSsXSbubAjB/Val_logo-pixel.png
fauxhumanoid
Newbie ⚓︎
*
View Profile WWWArt


⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2026!
« Reply #1 on: Summer in Year 5 @887 » Embed

so, what an infinite marquee does is clone your content then put it at the end so that it appears to be infinitely scrolling. i think the clone of your marquee content is either 1) not identical to the first, or 2) styled differently to where scaling discrepancies would happen. are you sure your clone matches exactly, or the javascript you're using is cloning it properly??

Logged

https://file.garden/ZZO2vbOs0CiXN-Ec/friendrewind/graphix/stamps/rei.gifhttps://file.garden/ZZO2vbOs0CiXN-Ec/friendrewind/graphix/stamps/css.pnghttps://file.garden/ZZO2vbOs0CiXN-Ec/friendrewind/graphix/stamps/sayaka.pnghttps://file.garden/ZZO2vbOs0CiXN-Ec/friendrewind/graphix/stamps/noellewhat.gifhttps://file.garden/ZZO2vbOs0CiXN-Ec/friendrewind/graphix/stamps/lain.gif
Dan Q
Hero Member ⚓︎
*****
View Profile WWWArt


I have no idea what I am doing
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Dan Q Cruisin'I DIDN'T meet Dan Q on Melonland!Visited on Melon's 10th Anniversary!
« Reply #2 on: Summer in Year 5 @521 » Embed

The single biggest problem that I can see is that you've got overflow: hidden on both the wrapper ("marqueeTrack") and on the contained "marquee-group"s. This frees the marquee-groups to be narrower and crop THEIR content, which trims off the ends of the stamps.

I see what you're aiming for with two marquee-groups, and then animating both of them. But you might find it simpler to put both the original and duplicate group inside some wrapper and animate THAT (but only move it half as far). That'd make the code simpler.

Alternatively, go the opposite direction and animate each stamp individually. This gives the benefit that you don't have to think about the wrapping: just animate each one back to the start at the end of its journey. This is tougher and you're likely to need some more-complex CSS, but it'll save you from having so much HTML (or in your case; lets you drop the JS dependency).

(Incidentally: I appreciate the aria-hidden on the duplicate marquee, but if it's just going to be images with no alt-text, you might as well aria-hidden the whole thing!)

I'd love to have a go at cracking it for you, but right now I'm sweating my ass off in the arrivals area of an under-cooled Spanish airport and I'm going to have to go find some transport presently. But if you're still stuck in a fortnight, resurrect this thread and I'll take a deeper look! (Odds are good somebody will have been able to help by then!)

Logged

https://danq.me/_q26t/badges/dan-q-88x31-lighter.gif https://danq.me/_q26t/badges/dan-q-88x31-peekaboo-scroller.gif https://beige-buttons.danq.dev/beige-buttons-88x31.gif https://embed-html.danq.dev/embed-html-88x31.gif

Artifact Swap: PolyamorousI met Dan Q on Melonland!Joined 2025!
Valery_04
Casual Poster ⚓︎
*
View Profile WWW


Zero's girlfriend
⛺︎ My Room

Guild Memberships:
Artifacts:
Nightrave (MMXOC, 8 bits)Joined 2026!
« Reply #3 on: Summer in Year 5 @945 » Embed

Thanks for helpling!  :unite:

I modified the CSS attributes (such as 'overflow', 'width' and '@keyframes'; duplicated image codes and deleted the script, so I give the code to everyone who wants a pure CSS infinite marquee similar to the HTML tag!

Code
.marquee-track {
  display: flex;
  overflow: hidden;
  width: auto;
}

.marquee-group {
  display: flex;
  justify-content: space-around;
  gap: 1px;
  width: 100%;
  animation: scrollMarquee 20s linear infinite;
}

.marquee-group img {
  height: auto;
  width: auto;
  object-fit: contain;
}

@keyframes scrollMarquee {
  0% {
    transform: translateX(0%);
  }
  100% {
    /* Moves exactly by the width of one group plus the structural gap */
    transform: translateX(calc(-100% - 100%));
  }
}

Logged

https://file.garden/aTyH7uSsXSbubAjB/Val_logo-pixel.png
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 Melon
Land
Editor Recent Edits Tenement Arcade Random Link Land → Forum Art Hub Chat Webring Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Newsletters Image Stream
Passport Sites Asatte Add your site?
Zap!
Minecraft: Online
Join: craft.melonking.net