Hi All,
I have a site where I have a horizontally styles un-ordered list (<ul>), my site dynamically adds items to the list based on user interactions. For each new item in the list, I have applied a Draggable.create call to make them draggable in the Y axis (vertical), I also apply an animation Tween on the item so it bounces into place. This all works fine!
Im using this code for that:
//add to the UL
$(".cardList").prepend(newDiv);
//animate the card into place
TweenLite.from(newDiv, 0.5, { y: -250, ease: Elastic.easeOut });
Draggable.create(newDiv, {
type: "y",
onDrag: function () {
//my code...
},
onDragEnd: function () {
//my code...
}
});
However, when there are a lot of items in the list, I would like to scroll the list horizontally, so I wrapped up my list into a DIV container and called:
var scroller = new Draggable("#cardsContainer", { type: "scrollLeft", edgeResistance: 1.0 });
...which 'kind of' works. I currently have 2 issues:
1) I can add a new item into the list and I can see that the scrollbar on the scroller increases, but from time to time, the scroller "snaps back" prematurely, so effectively you can never scroll to the end of the list. It simply stops scrolling, it looks like the animation I am using to add the new items to the list could have some effect on the calculation of the width of the scroller?
2) When I click and drag the scroller (when it does work), the items in the list which can scroll vertically move slightly up/down, can I have some kind of check to see if the user is scrolling left/right and NOT enable the vertical scroller based on some threshold?
I hope that makes sense