[英]Freeze vertical Scrollbar In a relative div using JQuery or Javascript
I am looking for a method to freeze a vertical scrollbar for a relative div. 我正在寻找一种冻结相对div的垂直滚动条的方法。 I cannot seem to find a comparable thread.
我似乎找不到类似的线程。 Fixed position will not work in this instance, as the div is actually a chart from Chap-links-library being used as a fixed axis.
固定位置在这种情况下不起作用,因为div实际上是Chap-links-library中的图表被用作固定轴。 I do not have to worry about the mousewheel, as I have reassigned this to control range changes.
我不必担心鼠标滚轮,因为我已经重新分配了它来控制范围更改。 For spacing and compatibility issues, however, I must display a scrollbar (or the elements fail to properly align).
但是,对于间距和兼容性问题,我必须显示一个滚动条(否则元素将无法正确对齐)。 Therefore, I cannot hide.
因此,我无法隐藏。 Is there a method of preventing the user from scrolling this div?
有没有一种方法可以防止用户滚动该div? I do not have to deal with horizontal scroll
我不必处理水平滚动
If it's just content within the divider that you don't want scrolling, you could use: 如果您只是不想滚动的分隔符中的内容,则可以使用:
$('div#id').scroll(function() {
$(this).scrollTop(fixedTopValue);
$(this).scrollLeft(fixedLeftValue);
})
If it's the entire page, just replace 'div#id' with window . 如果是整个页面,只需将window替换为“ div#id”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.