Closed reginabattle closed 9 years ago
It is a bad idea, but you can do it. Move the block of the modal to the specific div with detach
and appendTo
jquery methods.
Could you explain how this is done? I'm afraid I'm a jquery beginner.
Much obliged!
@Cailleach-Bhan It can be achieved with the following:
remodal.$wrapper.detach();
remodal.$wrapper.appendTo(".remodal-bg");
The modal is detached from the wrapper (body) and then appended to the div with the class "remodal-bg".
@VodkaBears I know this is closed but my query is definitely related! Would you be open to adding an appendTo option to specify an DOM element other than the body to append the modals to?
I'm using React with Remodal (not the reactified version) and it goes very much against the design to manipulate the DOM structure created by a react component (which is what Remodal is doing by moving the DOM element to the body) as React doesn't know how to deal with it implicitly. Unfortunately working with vendor libraries like this are a necessity and there sensible solutions using the component lifecycle hooks provided we're not mutating the DOM are available and work pretty well IMO as they are easy to reason about.
The alternative is to use a reactified version but for me dialogs are a UX concern, and I dont want to force UX developers to learn React in order to create some modals.
It's a great library, but without this feature I'm going to have to look for something else sadly :(
I would like the modal to stay in a specific div rather than the body.
How should I go about getting this done?