Prevent Scrolling When Modal Opened

Hi there.

Site: https://fantasy-books.live
X Pro: 2.0.1

Problem:

How can I prevent scrolling when a modal is open? But I don’t want to stop scrolling within the modal. Just the window.

https://fantasy-books.live/index/hello-heir/ is where you can find an example of the modal set up.

J.

Thanks.

Hi there,

It is not possible, unfortunately. The x-modal which you used to show the popup does not add any class or indicator in the HTML tag to be able to know when the modal is on. If it provided such a feature, for example, if it added the modalopened class. Then using the CSS code below would do the trick:

html.modalopened {
overflow: hidden;
}

You either need to use another system for the popup to have such a functionality or hire a developer to code such a functionality for the x-modal.

Thank you for your understanding.

That’s unfortunate, but I understand.

Thanks.

Thank you for your understanding.

Take care!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.