tkahn / Smooth-Div-Scroll

A jQuery plugin for smooth scrolling. No longer maintained.
471 stars 184 forks source link

When window is wider then the sum of scrollable items width, it gets glitchy #66

Closed sannu closed 11 years ago

sannu commented 11 years ago

Hi! heres fiddle for ya: http://jsfiddle.net/sndr/msGUK/1/ strech the result window enough to see the effect

tkahn commented 11 years ago

Hi!

Yes, this is a problem. But it's a problem that is "built-in" to the very logic of how SmoothDivScroll works. If the width of all scrollable elements is less than the width of the scroller (or window if the scroller covers all of the window) there really is no need for a scroller since you can view all the elements on one screen. But I still see your point and this will become increasingly important as responsive web pages become more common.

Do you have any suggestion as to what you would like to happen if the content is not wide enough to fill the scroller?

Regards, Thomas

sannu commented 11 years ago

Hey!

Here are my ideas:

  1. Safest bet would be infinite loop scroll for content(future option? to scroll at directions by the with or height of content one's scrolling)
  2. If some of the content is not visible in viewport then scroller is enabled(under the condition that content becomes visible for the scroller when it's full with or height is exposed)
tkahn commented 11 years ago

I have considered duplicating the content of the scroller if there's not enough content to make the swapping action work like it should. But in doing that I would introduce a number of other problems. What if you have endless autoscrolling when the page loads and manual scrolling when the user starts interacting with the scoller. Then you'd be stuck with extraneous content that doesn't really belong in the scroller because you (as a developer) haven't put it there. I have a hunch it would become confusing. And it would become very difficult to have the plugin keep track of duplicate content added to the scoller and when to keep it and when to remove it.

So the basic advice when you use endless scrolling is: split up your content so Smooth Div Scroll can swap elements properly and make sure you have enough elements to go around.