X
X
XXXprog2018-01-30 12:31:45
JavaScript
XXXprog, 2018-01-30 12:31:45

Why doesn't the magnific popup window open?

When 1 magnific popup window is active (open), the second one is not opened. What could be the reason for such behaviour?

Here is the function for the second window, tied to a button click.

$('.submit-button').click(function(){
  $.magnificPopup.open({
    items: {
    src: '<h1>Hello!</h1>',
    type: 'inline',
    }
  });
});


Weird, this is how it works:

$('.submit-button').click(function() {
    setTimeout(function() {
        $.magnificPopup.open({
            items: {
                src: '#solution-for-form', // can be a HTML string, jQuery object, or CSS selector
                type: 'inline',
            }
        });
    }, 0)
});

Can anyone explain what is even happening?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Kalibrov, 2018-01-30
@rework

You need to call close first :

$('.submit-button').click(function(){
  $.magnificPopup.close();
  $.magnificPopup.open({
    items: {
    src: '<h1>Hello!</h1>',
    type: 'inline',
    }
  });
});

A
Ainur Valiev, 2018-01-30
@vaajnur

look DOM, on which the output agent is hung. did the html of the modal itself render?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question