Configured a popup based on a block, with layout Bottom Right, no overlay, trigger=Automatic and 5s delay.
After 5 seconds the popup appears, but the contents are missing. All you see is a thin horizontal line because only the frame is being rendered, not the form that was configured in the region.
Looking at the code, it's because of this in simple_popup_blocks.js:
// Automatic trigger with delay
if (values.trigger_method == 0 && values.delay > 0) {
delays = values.delay * 1000
$('.' + modal_class).delay(delays).fadeIn('slow')
if (values.overlay == 1) {
setTimeout(stopTheScroll, delays)
}
}
The "fadeIn" line is only acting on the outer class and misses out the contents.
Adding the following line fixes the problem:
// Automatic trigger with delay
if (values.trigger_method == 0 && values.delay > 0) {
delays = values.delay * 1000
$('.' + modal_class).delay(delays).fadeIn('slow')
$(css_identity + block_id).delay(delays).fadeIn('slow') // Added
if (values.overlay == 1) {
setTimeout(stopTheScroll, delays)
}
}
The patched js file is attached.
Let me know if you need any further information.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | delayed-popup-content-invisible-3040744-14.patch | 516 bytes | nataliajustice |
| #4 | delayed-popup-content-invisible_3040744_4.patch | 496 bytes | s_leu |
| simple_popup_blocks.zip | 2.16 KB | opsdemon |
Comments
Comment #2
opsdemon commentedComment #3
opsdemon commentedComment #4
s_leu commentedCan confirm that this is a problem with a popup configured to show automatically with a delay.
@opsdemon Thanks for providing the code to solve this and pointing this out. In order to streamline the committing of your code please consider to write a patch next time instead of uploading a zip file. This also helps reviewing and adding the patch in composer.json of installations that want to use the fix.
Adding a patch here:
Comment #5
stevenx commentedThe Patch works. Thanks
Comment #7
dantesinferno commentedHey I'm using this module to build a custom popup with a custom form.
I've faced the same problem, the form content was not showing but the patch didn't work for me, because the form was being wrapped multiple times and all of the children with the "modal_class" variable were always with "display: none".
I'm not sure if it's just me but just in case someone get the same problem, I finally got it working by editing the code on line 63:
"$(css_identity + block_id)." before
"$(css_identity + block_id).once()." after
I think it happens sometimes when you have functions inside a behavior function the events are triggered more than once.
I'm not a drupal expert though but this module has saved me a lot of time, thanks.
Comment #9
mattbloomfield commentedThank you, that change in #7 has been committed.
Comment #10
mattbloomfield commentedComment #12
mellowtothemax commentedPatch #4 works for me too. It hasn't been committed in the latest version 8.x-2.8 however.
Comment #13
mefron commentedI noticed that this issue seemed to re-appear (I installed this module yesterday and found that delaying the popup caused led to an empty notification). The previously accepted patch no longer applies to the needed file, so I generated a new one. Perhaps it will help someone...I cant' recall how to upload a patch file, so I'm pasting the contents of my patchfile here:
Comment #14
nataliajustice commentedThe issue is appearing again. The solution of #13 is working fine. I have created a new patch to upload it to the issue
Comment #15
vasyok commentedDublicate?
https://www.drupal.org/project/simple_popup_blocks/issues/3381678