jQuery:滚动滚动-可能吗? [英] jQuery: snapped scrolling - possible?

查看:63
本文介绍了jQuery:滚动滚动-可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有固定标题的可滚动表. 滚动条上是否可以有快照滚动"功能-这意味着表行将不会逐像素滚动,而是响应其行高而捕捉,以便更好地查看.

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.

推荐答案

我要做的是将一个0px宽的虚拟DIV(带有滚动条)设置为与目标DIV相同的高度,而没有滚动条.

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.

然后,我将跟踪虚拟DIV的滚动偏移量,以设置目标DIV的滚动属性.对于用户而言,它会感觉流畅,自然且最透明,这对于获得良好的体验非常重要.

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.

这篇关于jQuery:滚动滚动-可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆