Jump to content
Search Community

Using JS database and GSAP to show video for portfolio projects

Serafla test
Moderator Tag

Recommended Posts

Hi, I posted recently about the same portfolio website I'm currently developing. I'm using a database in JS to reference data attributes for each project, and wanted to embed an mp4 video for certain projects using an if/then statement. If the project doesn't have a video, I'm using GSAP to set its display to none. However, I'm not sure if my syntax is correct for referencing the video DOM element as it's not displaying, and is causing the rest of my images in the gallery to not show. 

 

 

674060856_ScreenShot2022-03-14at7_22_11PM.thumb.png.d8d276ab446470fab34d517fb2d77e5c.png

See the Pen GRygLmQ by serafla (@serafla) on CodePen

Link to comment
Share on other sites

Looks like you've various problems here: 

  • You were missing the ending Array bracket ("]") on your projects (syntax error)
  • localStorage.getItem("indexValue") us evaluating as null, thus projects[localStorage.getItem("indexValue")].video throws an error
  • You didn't load GSAP in your CodePen

So from what I can tell, none of this has anything to do with GSAP :)

 

Let us know if there are any GSAP-related questions you need help with. Good luck!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...