javascriptjqueryiframemagnific-popup

Magnific popup target to iframe parent


I have a web-page with some small iframes, When user click on a button in iframe - shows big form with type: inline. How would I get the popup to open in the parent page?


Solution

  • Edited In latest versions - even easier. Author add param prependTo

     var conf = {type: 'inline', preloader: false};
     if (window.location != window.parent.location) {
         conf.prependTo = window.parent.$('body');
     }
    

    Done. Little, ugly hack Add new option - target

    var conf = {type: 'inline', preloader: false};
    if (window.location != window.parent.location) {
        conf.target = $(window.parent.window);
    }
    

    And in source, in function addGroup

    if (typeof options.target != 'undefined') {
        _window = options.target;
    } else {
        _window = $(window);
    }