$(document).ready(function() {
$('.image-link').magnificPopup({type:'image'});
});<?php
/**
* add Magific Popup Snippet
*
* DESCRIPTION
*
* This Snippet add the magnific-popup.js and css to the head of the page as well as the initialization script that
* targets which div to run the script on. Script gets inserted at the bottom
*/
/*loads magnific css file in the head*/
$modx->regClientCSS('assets/css/magnific-popup.css');
/*loads the magnific js in the head*/
$modx->regClientStartupScript('assets/js/jquery.magnific-popup.min.js');
$myMagnificPopUp='<script>
$(document).ready(function() {
$(\'.image-link\').magnificPopup({type:\'image\'});
});
</script>'
$modx->regClientScript($myMagnificPopUp);This question has been answered by Jako. See the first response.
Line 21 misses a semicolon. That could cause a PHP error in the snippet.
You have to call jquery script in the template too. If jQuery is included in the template at the end of the body, you should call jquery.magnific-popup.min.js there too with $modx->regClientScript. Otherwise there could occur a Javascript error ($ is not defined).