<?php // Add the colorbox style sheet $GLOBALS['TL_CSS'][] = 'assets/colorbox/css/colorbox.min.css|static'; ?> <script src="<?= $this->asset('js/colorbox.min.js', 'contao-components/colorbox') ?>"></script> <script type="text/javascript"> jQuery(function ($) { $('a[data-lightbox]:not(.video-link)').map(function () { $(this).colorbox({ // Put custom options here loop: false, rel: $(this).attr('data-lightbox'), maxWidth: '95%', maxHeight: '95%' }); }); }); $(window).on('load', function () { if (Cookies.get('cookie_iframes')) { $('.video-link').colorbox({ iframe: true, width: '95%', height: '95%', maxWidth: '1024px', maxHeight: '576px', href: function () { var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href); if (videoId && videoId[1]) { return '//www.youtube-nocookie.com/embed/' + videoId[1] + '?rel=0&wmode=transparent&autoplay=1'; } } }); } }); </script>