Magnific Popup
Examples using this library to implement and use custom-coded popups (a library that comes within the theme and is lazy loaded)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Document ready. | |
jQuery(function ($) { | |
// Load magnific popup library. | |
$.loadMagnificPopup().then(() => { | |
// Initialise and open popup. | |
$.magnificPopup.open({ | |
items: { | |
src: 'http://www.youtube.com/watch?v=0O2aH4XLbto' | |
}, | |
type: 'iframe' | |
}) | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Document ready. | |
jQuery(function ($) { | |
// Initialise and open popup if clicked on element with class open-popup. | |
$('.open-popup').lazyMagnificPopup({ | |
items: { | |
src: 'http://www.youtube.com/watch?v=0O2aH4XLbto' | |
}, | |
type: 'iframe' | |
}) | |
}) |
Ensure that dependencies are correct when enqueuing a script array( 'jquery', 'flatsome-js' )
with wp_enqueue_script or wp_register_script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', function () { | |
wp_register_script( | |
'child-main-js', | |
get_stylesheet_directory_uri() . '/main.js', | |
array( 'jquery', 'flatsome-js' ), | |
'0.0.1', | |
true | |
); | |
wp_enqueue_script( 'child-main-js' ); | |
} ); |