A
A
Aleksandr2016-04-27 14:55:15
JavaScript
Aleksandr, 2016-04-27 14:55:15

Popup in popup?

There is such a code for opening a popup window.

open: function(e) {
        var view = this
        e.preventDefault()
        var self = $(e.currentTarget)
        var src = self.attr('data-open')
        var href = self.href
        if (src.substr(0, 1) === '#') {
            $.fancybox($(src).html(), {
                type: 'html'
            });
        } else {
            $.fancybox.showLoading()
            $.ajax({
                type: 'get',
                url: src,
                data: {
                    'ajax': '1'
                }
            })
            .done(function(data) {
                var data = $(data)
                $(data).find('form').bind('submit', function(e) {
                    view.submitAjax(e)
                })
                $.fancybox(data)
                
                $('.fancyboxHide').click(function(event) {
                    $.fancybox.close();
                });
            })
            .fail(function() {
                $.fancybox.hideLoading()
                alert('("' + src + '") окно не доступно,\nбудет выполнена переадресация')
                window.location.href = href
            })
        }
    },

Tell me, how can I change the script so that in the popup it was possible to open another popup by clicking on data-open?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2016-04-27
@Sashjkeee

So people write that fancybox can only open one of its windows by design

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question