-
Posts
1,002 -
Joined
-
Last visited
-
Days Won
71
Sahil's Achievements
Single Status Update
-
Hi Sahil, I was trying to expand on a codepen that you did called "Draggable with Snap" and would love some help, if you could (Ive linked to your codepen below) . Question(s), How can I assign an 'active' class to whichever the current slide might be? And just one other thing
, I'd like to add new slides on the fly, so I made a button that appends a new slide instance to the #slider div - and it shows up in the console - but, not in the slider with the other slides. Ive been having a hard time with this and would greatly appreciate any help you could offer. Thanks!
-
Hi Jesse,
Seems like you attached my pen. Here is how you can add active class to a slide, check code added in setProgress function,
To add new slides, you need to reselect slides in jQuery so the new elements will be selected. You need to recalculate the sliderLength to accommodate the added elements and you need to calculate the x translate of the '#slider'. Basically you need to do what I am doing on resize event.
If you have anymore questions please post them in the Forum where others can see it.
-
-