0

Использую magnific popup на сайте для всех модальных окон. Как сделать плавное их появление. Может есть настройка плагина?

2 ответа 2

2

Из официальной документации

CSS

/* overlay at start */
.mfp-fade.mfp-bg {
  opacity: 0;

  -webkit-transition: all 0.35s ease-out;
  -moz-transition: all 0.35s ease-out;
  transition: all 0.35s ease-out;
}
/* overlay animate in */
.mfp-fade.mfp-bg.mfp-ready {
  opacity: 0.8;
}
/* overlay animate out */
.mfp-fade.mfp-bg.mfp-removing {
  opacity: 0;
}

/* content at start */
.mfp-fade.mfp-wrap .mfp-content {
  opacity: 0;

  -webkit-transition: all 0.35s ease-out;
  -moz-transition: all 0.35s ease-out;
  transition: all 0.35s ease-out;
}
/* content animate it */
.mfp-fade.mfp-wrap.mfp-ready .mfp-content {
  opacity: 1;
}
/* content animate out */
.mfp-fade.mfp-wrap.mfp-removing .mfp-content {
  opacity: 0;
}

При инициализации magnificPopup в объект добавить

mainClass: 'mfp-fade'

Пример инициализации

$('.popup-link').magnificPopup({
  removalDelay: 350,
  mainClass: 'mfp-fade'
});

Демо: http://codepen.io/anon/pen/qZYZMp

1

Есть готовый сниппет. Добавьте в CSS следующее:

.mfp-fade.mfp-bg {
    opacity: 0;
    background: #00;
    transition: all .3s;
}

.mfp-fade.mfp-bg.mfp-ready    { opacity: .9; }
.mfp-fade.mfp-bg.mfp-removing { opacity: 0; }

.mfp-fade.mfp-wrap .mfp-content {
    opacity: 0;
    transition: all .3s;
}

.mfp-fade.mfp-wrap.mfp-ready .mfp-content    { opacity: 1; }
.mfp-fade.mfp-wrap.mfp-removing .mfp-content { opacity: 0; }

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.