This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to temporarily stop the scroll (Modal case) #119
Comments
You can use plugin system to do this: import Scrollbar, { ScrollbarPlugin } from 'smooth-scrollbar';
class ModalPlugin extends ScrollbarPlugin {
static pluginName = 'modal';
static defaultOptions = {
open: false,
};
transformDelta(delta) {
return this.options.open ? { x: 0, y: 0 } : delta;
}
}
Scrollbar.use(ModalPlugin, /* OverscrollPlugin */);
// usage
const scrollbar = Scrollbar.init(elem);
onModalOpen -> scrollbar.updatePluginOptions('modal', { open: true });
onModalClose -> scrollbar.updatePluginOptions('modal', { open: false }); |
Brilliant, way better than my approach ! 馃帀 |
It's so cool, Thanks. |
thank you |
@idiotWu hi how |
I have same problem, where I use dropdown as modal on desktop resolutions. I noticed if you create modal outside of main smooth scroll wrapper and initalize modal smooth scroll, you wont be able to scroll main scroll as long as mouse is over modal. So, if you have modal over whole screen (or modal backdrop), everything should work as expected, without disabling or destroying any smooth scrollbar. So, I think best partice would be, if you have more than one smooth scrollbar wrappers, you should place each outside of it. |
@robizzt
but when you have I test everything coz I needed to header and menu outside of wrapper and at last I find no solution for it this.scrollbar.track.yAxis.element.style.display = "none" |
I decided to go with |
How can I implement the same in JQuery, please help me. |
@idiotWu , Thank you for amazing library! For example: Do I miss something, or should i use another workaround for my task? Thank you for reply! |
+1, it's also interesting to see a solution in JQuery. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
"smooth-scrollbar": "^8.2.4"
Again, awesome scroll 馃憤
Hi, maybe is a silly question, but i didn't find a method to block the scroll on the page ( without destroy it )
like for example if
Thanks in advance
The text was updated successfully, but these errors were encountered: