Jump to content
Search Community

Some Problem with GSAP Slider

AsKadir test
Moderator Tag

Recommended Posts

Hi!

I have some problem with TweenMax when trying to make a slider,

I found some code in youtube and get new idea.

And now I made a simple slider, everything worked fine.

But then I wanted to add some animation for the next and previous slides.

If you click on PREV button you could see what I want to reach with NEXT button, but when my activeSlide gets 0, I get an error:

Uncaught Cannot tween a null target.

What am I doing wrong?

Can you help me, please?

Sorry for my English.

See the Pen OJPBaez by ChicagoJostik (@ChicagoJostik) on CodePen

Link to comment
Share on other sites

Hey AslanGoi,

 

This really does not look like a GSAP specific question, but more of the logic in which your custom slider pagination works. The error about the target being null means that slides[nextSlide] (the line that the error points to) is null. That means that your logic is wrong related to the next slide. Fix that and the problem will go away :) 

It looks like you (or whoever made that video) got most of the core code from this post: 

 

  • Like 1
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...