M
M
maldoff2018-02-06 18:55:50
JavaScript
maldoff, 2018-02-06 18:55:50

How to animate magnificPopup modal on page load?

The magnificPopup documentation has examples of animations when a modal is invoked. But nowhere can I find an example of how to make an animation (for example, zoom) of the appearance of a window when the page loads. Found on the forums a few remotely resembling examples, but does not work. Help me please! Here is the preparation:

$.magnificPopup.open({
  items: {
      	src: '#form',
      	type: 'inline'
  },
  closeBtnInside: true
});

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Gerasimov, 2018-02-06
@mrTeo

Hang an event on page load, for example, like this:

<script>
  function ready() {
    $.magnificPopup.open({
  items: {
      	src: '#form',
      	type: 'inline'
  },
  closeBtnInside: true
});
  }

document.addEventListener("DOMContentLoaded", ready);

M
maldoff, 2018-02-06
@maldoff

I'll explain in more detail. There are examples of animations https://codepen.io/dimsemenov/pen/GAIkt
But here the window is called: $('#inline-popups').magnificPopup and inside the animation, but you need without the click event $.magnificPopup.open
And now if I For this example, I try to hang the animation, it does not work for some reason. Apparently the methods need to be specified differently?

S
Serg Bakay, 2018-02-28
@Bakay_Sergey

the whole trick is in the class on which css animations are hung:
you can customize them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question