humaan / Modaal

An accessible dialog window library for all humans.
http://humaan.com/modaal/
MIT License
2.72k stars 183 forks source link

Change of source image within content-source conflict #120

Open hirschferkel opened 5 years ago

hirschferkel commented 5 years ago

When i try to change the src e.g. within an iframe which is part of the content_source of modaal, modaal will reload the whole content, which I want to disable.
If I have to modaal setup it even recognizes that there is a change in another iframe and makes some updates in the back, which I can not catch.

The problem is, that this "page update" ist sometimes after after_close.

How can I prevent Modaal from reloading the content_source even of other iframes which use the same modaal on one page?

Best, hirschferkel

danhumaan commented 5 years ago

hi @hirschferkel, can't say i've experience what I think you're describing, can you please provide an example of the issue hitting? Maybe setup a JS fiddle or something similar so we can see. It might be an issue with modaal or something else on the page.

hirschferkel commented 5 years ago

@danb-humaan thanks for your answer, which actually helped me to find the problem. I integrated a trigger-button within the element, which was getting loaded with modaal. After opening modaal I wanted to hide this button, while modaal is active. It shoulg getsvisible again, when modaal is closed.

All problems resulted in the injection of the code after the overlay is closed, as modaal fires the after_close function while it starts the injection of the code into its origin and not after the injection has finished! So I had to integrate some checks if the elements are already loaded before actions take place. They just are ignored when modaal fires too early.

I think this is no problem with images, but with more complex elements.

You can have a look at the finished integration if you want: Modaal Map Changer Overlay