darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

infinite horizontal scroll when scrolling to the left doesnt work properly #125

Open thinksalot opened 10 years ago

thinksalot commented 10 years ago

Hello, I am trying to create a calender scroller that loads item in both directions in a horizontal scroll. When trying to load items infinitely to the left of the scroll, the new item just prepended gets activated instead of the item just next to it. Seems like bug.

In the example below, try clicking to the left most page button and you'll see that the new item just loaded/appended is selected automatically which is not the desired result. But it works as intended when scrolling to the right. http://jsfiddle.net/6y35c/3/

darsain commented 10 years ago

Yes. That's why .add() method was created.

thinksalot commented 10 years ago

Hi, Thanks for the reply. Updated code using add and still no effect. http://jsfiddle.net/6y35c/4/ When i click on the leftmost page button, i want to keep focus on the item just clicked but append a new page before it. But even with .add(), the focus moves back to the item just added. Dont think its working as i intend it to.

darsain commented 10 years ago

I've looked into it, and that is unfortunately how Sly works right now. Infinity towards the start is just not accounted for.

I'll try to come up with something tomorrow, but no promises. Sly needs to be rewritten and refocused, so I'm trying to not waste much time on new stuff for its current state.

thinksalot commented 10 years ago

That would be great, thanks !

I have found a temporary fix where i activate the clicked item manually after adding an item to the start. Doesnt work when multiple items are added but atleast it works for now

darsain commented 10 years ago

Sorry, this would mean some non-trivial loading refactoring. I'll leave it for the next major version. Current Sly is a little mess :/

I'll leave this open as a reminder and note for others trying to do the same thing.

odahcam commented 7 years ago

Any update on this? :D