lavkach3

Форк
0
135 строк · 3.5 Кб
1
$(function () {
2
  $(".image-popup-vertical-fit").magnificPopup({
3
    type: "image",
4
    closeOnContentClick: true,
5
    mainClass: "mfp-img-mobile",
6
    image: {
7
      verticalFit: true,
8
    },
9
  });
10

11
  $(".image-popup-fit-width").magnificPopup({
12
    type: "image",
13
    closeOnContentClick: true,
14
    image: {
15
      verticalFit: false,
16
    },
17
  });
18

19
  $(".image-popup-no-margins").magnificPopup({
20
    type: "image",
21
    closeOnContentClick: true,
22
    closeBtnInside: false,
23
    fixedContentPos: true,
24
    mainClass: "mfp-no-margins mfp-with-zoom", // class to remove default margin from left and right side
25
    image: {
26
      verticalFit: true,
27
    },
28
    zoom: {
29
      enabled: true,
30
      duration: 300, // don't foget to change the duration also in CSS
31
    },
32
  });
33

34
  $(".popup-gallery").magnificPopup({
35
    delegate: "a",
36
    type: "image",
37
    tLoading: "Loading image #%curr%...",
38
    mainClass: "mfp-img-mobile",
39
    gallery: {
40
      enabled: true,
41
      navigateByImgClick: true,
42
      preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
43
    },
44
    image: {
45
      tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
46
      titleSrc: function (item) {
47
        return item.el.attr("title") + "<small>by Marsel Van Oosten</small>";
48
      },
49
    },
50
  });
51

52
  $(".zoom-gallery").magnificPopup({
53
    delegate: "a",
54
    type: "image",
55
    closeOnContentClick: false,
56
    closeBtnInside: false,
57
    mainClass: "mfp-with-zoom mfp-img-mobile",
58
    image: {
59
      verticalFit: true,
60
      titleSrc: function (item) {
61
        return (
62
          item.el.attr("title") +
63
          ' &middot; <a class="image-source-link" href="' +
64
          item.el.attr("data-source") +
65
          '" target="_blank">image source</a>'
66
        );
67
      },
68
    },
69
    gallery: {
70
      enabled: true,
71
    },
72
    zoom: {
73
      enabled: true,
74
      duration: 300, // don't foget to change the duration also in CSS
75
      opener: function (element) {
76
        return element.find("img");
77
      },
78
    },
79
  });
80

81
  $("#image-popups").magnificPopup({
82
    delegate: "a",
83
    type: "image",
84
    removalDelay: 500, //delay removal by X to allow out-animation
85
    callbacks: {
86
      beforeOpen: function () {
87
        // just a hack that adds mfp-anim class to markup
88
        this.st.image.markup = this.st.image.markup.replace(
89
          "mfp-figure",
90
          "mfp-figure mfp-with-anim"
91
        );
92
        this.st.mainClass = this.st.el.attr("data-effect");
93
      },
94
    },
95
    closeOnContentClick: true,
96
    midClick: true, // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
97
  });
98

99
  $(".popup-youtube, .popup-vimeo, .popup-gmaps").magnificPopup({
100
    disableOn: 700,
101
    type: "iframe",
102
    mainClass: "mfp-fade",
103
    removalDelay: 160,
104
    preloader: false,
105

106
    fixedContentPos: false,
107
  });
108
  $(".popup-with-form").magnificPopup({
109
    type: "inline",
110
    preloader: false,
111
    focus: "#name",
112

113
    // When elemened is focused, some mobile browsers in some cases zoom in
114
    // It looks not nice, so we disable it:
115
    callbacks: {
116
      beforeOpen: function () {
117
        if ($(window).width() < 700) {
118
          this.st.focus = false;
119
        } else {
120
          this.st.focus = "#name";
121
        }
122
      },
123
    },
124
  });
125

126
  $(".simple-ajax-popup-align-top").magnificPopup({
127
    type: "ajax",
128
    alignTop: true,
129
    overflowY: "scroll", // as we know that popup content is tall we set scroll overflow by default to avoid jump
130
  });
131

132
  $(".simple-ajax-popup").magnificPopup({
133
    type: "ajax",
134
  });
135
});
136

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.