The plugin’s free version will work only on static images, i.e. images that are present on the page during page load. Unfortunately the plugin will not work with an image within a popup/modal window.
The plugin’s pro version is a bit more flexible and it works with different carousels and images within lightboxes (images that dynamically show up after the page load). But for every lightbox we have to manually build a compatibility, as the zoom needs to recognize when the lightbox gets open and when it closes in order for the zoom to get applied and, respectively, get removed.
The zoom or the modal window cannot possibly generate a source code, as you mentioned. I assume you mean that it generated an error. Also you forgot to link any of the “this generated source code” about which you’re asking my opinion.