I'm having a scrollable table with fixed header. Would it be possible to have "snapped scrolling" on the scrollbar - which means that the table rows won't scroll pixel by pixel but snap responding to its row height, for better viewing.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
the answer is 'yes' .. you can adjust .scrollTop and make it be anything you want in response to an onscroll event
read about scrollTop here
read about the scroll event here
回答2:
What I would do is have a 0px-wide Dummy DIV—with a scrollbar—set to the same height as the Target DIV—with no scrollbar.
I would then track the scroll-offset of the Dummy DIV for setting the Target DIV's scroll attribute. It would feel fluid, natural, and the most transparent to the user, which is really important for a good experience.