Freeze vertical Scrollbar In a relative div using JQuery or Javascript

1.2k Views Asked by At

I am looking for a method to freeze a vertical scrollbar for a relative 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. 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? I do not have to deal with horizontal scroll

1

There are 1 best solutions below

0
On

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.