Magnific-Popup
Magnific-Popup copied to clipboard
Prepend to option?
I'm using this plugin on an ASP.net project, and because the modal box prepends to document.body, which is outside of the form element (which all .net controls must reside in), I lose the ability to have functional controls inside the modal box.
I resolved the issue in my project by replacing changing this line:
n.bgOverlay.add(n.wrap).prependTo($('#form1'))
Just wondering if there's an option you could throw in that you could place a class or ID to, and have the modal prepend to that element instead of the default document.body?
Sorry for late response, be careful with this, as if your form doesn't fill 100% width and height of a window, you might get into troubles on mobile. To force same layout on desktop and mobile set fixedContentPos and bgpos to true or false http://dimsemenov.com/plugins/magnific-popup/documentation.html#fixedcontentpos
I guess you were changing this line: https://github.com/dimsemenov/Magnific-Popup/blob/master/src/js/core.js#L380
I don't have much experience with ASP.net, so if this works for you, you may submit a commit.
I think is good to have this option. I think it won't break any core issues (but developer must know what he/she is doing), developer only use css to style what they need to fit their requirement. This will also solve this issue related: https://github.com/dimsemenov/Magnific-Popup/issues/166
In my case, I have a SPA site where section by section scrolling. Client preferred to have that video popup inside that section instead of modal pop up overlay the whole page.
Is good to have this option something like:
// Append to any ID or class element container
$('.some-button').magnificPopup({
appendTo: $('#myVideoContainer')
});
// Append to closest parent element container
$('.some-button').magnificPopup({
appendTo: $(this).closest('.section-video-component')
});
This option would be a great addition to this magnificent plugin. Here is one popup plugin that have option to change append location (look for appendLocation option) http://github.hubspot.com/vex/api/advanced/
It seems that this option already exists #304 :) Why this is not closed as resolved?
Please add option like prepend to closest / parent div:
// Prepend to closest parent element container
$('.some-button').magnificPopup({
prependTo: $(this).closest('.section-video-component')
});
The option to prepend to closest parent will be very helpful. Hope this is addressed in the future.