Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: animations/image-trail Not showing up #141

Closed
1 task done
AmeyaBadge opened this issue Mar 4, 2025 · 2 comments
Closed
1 task done

[BUG]: animations/image-trail Not showing up #141

AmeyaBadge opened this issue Mar 4, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@AmeyaBadge
Copy link

Describe the issue

First thing is , the code in website doesnt set the height to the div, moreover, i installed it using npx jsrepo add and selecting from the list, and it didnt work , there was a error
ImageTrail.jsx:114 Uncaught TypeError: Cannot read properties of undefined (reading 'DOM')
at ImageTrailVariant1.showNextImage (ImageTrail.jsx:114:27)
at ImageTrailVariant1.render (ImageTrail.jsx:99:12)
at ImageTrail.jsx:84:40

it was because the image div rendered was missing the class .content__img, and content__img-inner so i had to add them

Reproduction Link

No response

Steps to reproduce

npx jsrepo add
select Image Trail
install it
Copy and paste code snippet from the docs website

Validations

  • I have checked other issues to see if my issue was already reported or addressed
@AmeyaBadge AmeyaBadge added the bug Something isn't working label Mar 4, 2025
@dev25-hs
Copy link

dev25-hs commented Mar 6, 2025

The error occurs because the querySelectorAll(".content__img") selector isn't finding the correct elements. In Image Trail component, the elements have the class name but are missing the content__img class. Let's fix this by adding the missing class:

<div className="w-full h-full relative z-[100] rounded-lg bg-transparent overflow-visible" ref={containerRef} > {items.map((url, i) => ( <div className="content__img w-[190px] aspect-[1.1] rounded-[15px] absolute top-0 left-0 opacity-0 overflow-hidden [will-change:transform,filter]" key={i} > <div className="content__img-inner bg-center bg-cover w-[calc(100%+20px)] h-[calc(100%+20px)] absolute top-[-10px] left-[-10px]" style={{ backgroundImage:url(${url}) }} /> </div> ))} </div>

The changes made:
Added content__img class to the outer div
Added content__img-inner class to the inner div
These classes are required for the ImageTrail variants to properly select and manipulate the elements. The error should now be resolved as the selectors will be able to find the elements with the correct class names.

@DavidHDev
Copy link
Owner

I've added the suggestion made by @WasiHaiderHS , closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants