Magnific Popup

Overview

Magnific Popup (v1.2.0) is the lightbox library for the Cynosure Design System. It handles inline modals, gated brochure downloads with Pardot/Gravity Forms, video embeds, and map overlays.

Popup types

Trigger classTypeUsed for
.js-open-content-popupInline modalGeneric inline popup; href points to a hidden #popup-id element
.eb-js-showcase-sliderInline (delegated)Product showcase slider; popup triggered on child .js-open-content-popup elements
.js-open-content-popup-brochureInline with callbackBrochure download gate; injects Pardot iframe src from data-pardot-url
.js-open-content-popup-assetInline with callbackAsset download gate; injects Pardot iframe into #download-paper-popup
.js-open-content-popup-asset-gfInline with AJAXAsset with Gravity Form; fetches form HTML via CYNO_DATA.ajax_url
.js-popup-mapInline with DOM moveMoves #gmap into #gmap-popup on open; restores on close
.js-open-videoiFrameYouTube/Vimeo video; URL taken from href
.js-open-wistia-video-popupiFrame (Wistia)Wistia video embed; URL pattern matched for wistia.com/medias/{id}

Importing the utility

JavaScript
1/** 2 * Download Block 3 * 4 * Gated brochure and asset downloads with Pardot form popups. 5 * 6 * @shared popup 7 * Trigger: .js-open-content-popup-brochure — brochure popup with Pardot iframe 8 * Trigger: .js-open-content-popup-asset — asset popup with Pardot iframe 9 * Library: Magnific Popup 1.2.0 + jQuery 10 * 11 * @see /guidelines/javascript/popup 12 * @see /guidelines/javascript/shared-utilities 13 */ 14import '../../js/components/popup.js';

Inline popup template

The popup content is an element already in the DOM, hidden with display: none. The trigger's href points to its id:

Handlebars
1{{!-- Trigger link --}} 2<a href="#brochure-popup" class="js-open-content-popup btn btn-primary" 3 data-pardot-url="{{properties.pardot_url}}" 4 data-modal-title="{{properties.popup_title}}" 5 data-modal-description="{{properties.popup_description}}" 6 data-modal-thumb="{{properties.popup_image.url}}"> 7 Download Brochure 8</a> 9 10{{!-- Hidden popup container (place at block root level) --}} 11<div id="brochure-popup" class="c-popup mfp-hide"> 12 <div class="c-popup__content"> 13 <h2><span></span></h2> 14 <p></p> 15 </div> 16 <div class="c-paper__pic"> 17 <img src="" alt=""> 18 </div> 19 <div class="c-popup__iframe"> 20 <iframe id="modal-pardot-iframe" src="" frameborder="0"></iframe> 21 </div> 22</div>

The popup.js utility injects data-pardot-url, data-modal-title, data-modal-description, and data-modal-thumb values into the popup DOM on open, and clears them on close.

Video popup template

Handlebars
1<a href="{{properties.video_url}}" class="js-open-video btn btn-primary"> 2 Watch Video 3</a>

No popup container is needed — Magnific Popup creates the iframe dynamically from the href URL.

Gravity Forms popup (AJAX)

For asset gating with a Gravity Form, the popup fetches the form HTML via a WordPress AJAX action:

Handlebars
1<a href="#gf-download-paper-popup" 2 class="js-open-content-popup-asset-gf btn btn-primary" 3 data-gf-id="{{properties.gravity_form_id}}" 4 data-modal-title="{{properties.popup_title}}" 5 data-modal-thumb="{{properties.popup_image.url}}"> 6 Download 7</a>

The popup.js utility sends action: 'gf_button_get_form' to CYNO_DATA.ajax_url and renders the form response into #gf-download-paper-popup #gform-container.

Blocks that use popup.js

download, downloads-columns, downloads-list, downloads-split, hero-contact

Accessibility notes

  • Magnific Popup traps focus within the popup while it is open.
  • The popup container should include role="dialog" and aria-labelledby pointing to the popup heading.
  • Ensure all close buttons have visible focus styles and an aria-label="Close" attribute.
  • Use mfp-fade class on the outer container for a CSS transition; combine with @media (prefers-reduced-motion: reduce) to disable transitions for users who prefer it.