drublic / css-modal

A modal built with pure CSS, enhanced with JavaScript
https://drublic.github.io/css-modal
MIT License
1.82k stars 211 forks source link

<iframe> breaks the js #199

Closed moonshark closed 8 years ago

moonshark commented 9 years ago

Hi

I love your plugin. Many thanks. However I have found a small bug. I implemented the plugin at work and on some pages the plugin js worked, some it did not and was driving me crazy. I have found it is an issue when an iframe is on the same page.

I have put together the following demo page. I apologise how bad the setup is.

https://jsfiddle.net/nwn8hphf/

If you remove the iframe then it works, the js class is added to the html tag and also the .is-active and .is-stackable is added to the popup forms. As soon as the iframe is added back in these classes are not added and the switching between form's seem's to break.

Any idea how to fix this? It does not matter what is in the iframe the plugin does not work.

Thanks Chris

adriaanbaelus commented 9 years ago

Chris

I had the same issue as you, so I submitted a pull request. I can't quite seem to fix it in your JSFiddle, but I suspect that may be because JSFiddle wraps the whole page in yet another iframe.

Try with #200, it might solve your issues.

Regards Adriaan

ghost commented 8 years ago

I would also like to see this issue solved!