lightbox.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/advanced/lightbox", ["jquery", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(require("jquery"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(global.jQuery, global.Site);
  11. global.advancedLightbox = mod.exports;
  12. }
  13. })(this, function (_jquery, _Site) {
  14. "use strict";
  15. _jquery = babelHelpers.interopRequireDefault(_jquery);
  16. (0, _jquery.default)(document).ready(function ($$$1) {
  17. (0, _Site.run)();
  18. }); // Example Popup Zoom Gallery
  19. // --------------------------
  20. (0, _jquery.default)('#exampleZoomGallery').magnificPopup({
  21. delegate: 'a',
  22. type: 'image',
  23. closeOnContentClick: false,
  24. closeBtnInside: false,
  25. mainClass: 'mfp-with-zoom mfp-img-mobile',
  26. image: {
  27. verticalFit: true,
  28. titleSrc: function titleSrc(item) {
  29. return item.el.attr('title') + ' &middot; <a class="image-source-link" href="' + item.el.attr('data-source') + '" target="_blank">image source</a>';
  30. }
  31. },
  32. gallery: {
  33. enabled: true
  34. },
  35. zoom: {
  36. enabled: true,
  37. duration: 300,
  38. // don't foget to change the duration also in CSS
  39. opener: function opener(element) {
  40. return element.find('img');
  41. }
  42. }
  43. }); // Example Popup Gallery
  44. // ---------------------
  45. (0, _jquery.default)('#exampleGallery').magnificPopup({
  46. delegate: 'a',
  47. type: 'image',
  48. tLoading: 'Loading image #%curr%...',
  49. mainClass: 'mfp-img-mobile',
  50. gallery: {
  51. enabled: true,
  52. navigateByImgClick: true,
  53. preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
  54. },
  55. image: {
  56. tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
  57. titleSrc: function titleSrc(item) {
  58. return item.el.attr('title') + '<small>by amazingSurge</small>';
  59. }
  60. }
  61. }); // Example Popup With Css Animation
  62. // --------------------------------
  63. (0, _jquery.default)('.popup-with-css-anim').magnificPopup({
  64. type: 'image',
  65. removalDelay: 500,
  66. preloader: true,
  67. callbacks: {
  68. beforeOpen: function beforeOpen() {
  69. this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
  70. this.st.mainClass = this.st.el.attr('data-effect');
  71. }
  72. },
  73. closeOnContentClick: true,
  74. midClick: true
  75. }); // Example Popup With Video Rr Map
  76. // -------------------------------
  77. (0, _jquery.default)('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
  78. disableOn: 700,
  79. type: 'iframe',
  80. mainClass: 'mfp-fade',
  81. removalDelay: 160,
  82. preloader: false,
  83. fixedContentPos: false
  84. }); // Example Popup With Video Rr Map
  85. // -------------------------------
  86. (0, _jquery.default)('#examplePopupForm').magnificPopup({
  87. type: 'inline',
  88. preloader: false,
  89. focus: '#inputName',
  90. // When elemened is focused, some mobile browsers in some cases zoom in
  91. // It looks not nice, so we disable it:
  92. callbacks: {
  93. beforeOpen: function beforeOpen() {
  94. if ((0, _jquery.default)(window).width() < 700) {
  95. this.st.focus = false;
  96. } else {
  97. this.st.focus = '#inputName';
  98. }
  99. }
  100. }
  101. }); // Example Ajax Popup
  102. // ------------------
  103. (0, _jquery.default)('#examplePopupAjaxAlignTop').magnificPopup({
  104. type: 'ajax',
  105. alignTop: true,
  106. overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump
  107. });
  108. (0, _jquery.default)('#examplePopupAjax').magnificPopup({
  109. type: 'ajax'
  110. }); // Example Popup Modal
  111. // -------------------
  112. (0, _jquery.default)('.popup-modal').magnificPopup({
  113. type: 'inline',
  114. preloader: false,
  115. modal: true
  116. });
  117. (0, _jquery.default)(document).on('click', '.popup-modal-dismiss', function (e) {
  118. e.preventDefault();
  119. _jquery.default.magnificPopup.close();
  120. }); // Example Error Handling
  121. // ----------------------
  122. (0, _jquery.default)('#exampleBrokenImage, #exampleBrokenAjax').magnificPopup({});
  123. });