Smooth-Div-Scroll icon indicating copy to clipboard operation
Smooth-Div-Scroll copied to clipboard

"scrollToElement" bugs when "manualContinuousScrolling: true"

Open BeatLaG opened this issue 12 years ago • 4 comments
trafficstars

Hi,

I created some thumbs to scroll directly to the elements and for some reason when I have enabled manualContinuousScolling the indexes are not working as they should. When you click on a thumb the scroller jumps/scroll to the wrong images.

Any idea about fixing this issue?

Thanks!

BeatLaG avatar Dec 09 '12 20:12 BeatLaG

Also having this issue with scrollToElement (number) not scrolling to the right images.

As a workaround, I tried setting the image id as #image0, #image1, etc and using scrollToElement (id). That didn't work very well, because sometimes the image is scrolled to the left and sometimes to the right, depending on whether it has been swapped by the continuous scrolling.

dsyddall avatar Dec 18 '12 16:12 dsyddall

Also having this issue

jaycode avatar Nov 07 '13 02:11 jaycode

Hi!

This is a hard nut to crack and as @dsyddall points out elements are swapped around to give the illusion of an endless scrolling row of elements. This swapping means that the order of the elements is altered continuously as long as the user scrolls and when you stop they freeze in the order they are currently at. It's kind of like the party game "musical chairs" but with HTML-elements.

Consider the options:

  1. Keep duplicating elements the further the user scrolls. As you understand this is a really bad idea since it would create lot's of duplicate elements in the code and make the scroller very long. Not an option.
  2. Restore the original order after the user has finished scrolling. This would result in a very strange jump/flash/warp where the images and their position in the scroller would be altered every time you stopped scrolling. Not an option.
  3. Wrap all the original elements in a wrapper-div, duplicate this div and keep swapping between these two divs. When the user has finished scrolling, remove the duplicate div and the wrapper and restore the scrolling position in the remaining (original) row of elements. This could be an option but would generate a lot of complicated code and overhead DOM-manipulation. My guess is it would make the code too complicated and unpredictable to test and work with in the long run. If someone want's to try, you're welcome though.

Having read this I hope you get a deeper understanding of the issue and the reason why Smooth Div Scroll works like it does. I still understand that it would be nice to have "total recall" after the continuous scrolling is done, it's just that it's very hard to get it working predictably and with good performance.

The solution that @dsyddall uses is currently the best option even though it scrolls in different directions depending on the current order of the elements.

If you have any good ideas, I'm all ears. :-)

/Thomas

tkahn avatar Dec 17 '13 10:12 tkahn

I would suggest temporarily disabling the continuous scrolling , use the jump to element, then on completion enable the continuous scrolling if this is possible?

I have a similar situation where I am simply disabling smoothdivscroll temporarily which works for me.

cresc avatar Mar 01 '14 09:03 cresc