Open iframe manually in nyroModal?

2019-01-15 11:41发布

问题:

I am trying to get nyroModal to open in an iframe, directly from JavaScript.

To clarify, the following is not what I need:

$.nmManual(url); // not an iframe

because it does not open an iframe.

This will also not work:

<a href="http://someurl.com/" target="_blank" class="nyroModal">click me</a>
<script type="text/javascript"> $(".nyroModal").nyroModal(); </script>

because I really need to launch it directly from JavaScript.

I've looked through the documentation, and I can't find any obvious way to do this. Any ideas?

回答1:

$.nmManual can also be used to open an iframe, using the filters:

$.nmManual('http://someurl.com/', {
    callbacks: { 
      initFilters: function(nm) {
      nm.filters.push('link');
      nm.filters.push('iframe');
    }
  }
});