Zitat von
Spooky
Ok, aber du hast ja geschrieben, dass genau das eben nicht funktioniert
Dann habe ich das falsch formuliert. Bilder funktionieren, Youtube Links/Videos funktionieren nicht.
Also wenn ich im Bild einen Youtube Link verwende wird im Frontend nicht das Attribut data-lightbox bei Elementen mit Links ausgegeben.
Meine j_lightbox sieht so aus:
HTML-Code:
<?php
// Add the colorbox style sheet
$GLOBALS['TL_CSS'][] = 'assets/colorbox/css/colorbox.min.css|static';
?>
<script src="<?= TL_ASSETS_URL ?>assets/colorbox/js/colorbox.min.js"></script> -->
<script>
(function($) {
$(document).ready(function() {
$('a[data-lightbox]').map(function() {
var isIFrame = false;
if($(this).attr('href').split('.').pop() == 'html' || $(this).attr('href').indexOf('youtube.com') != -1) {
isIFrame = true;
}
$(this).colorbox({
// Put custom options here
loop: false,
rel: $(this).attr('data-lightbox'),
maxWidth: '95%',
maxHeight: '95%',
width: isIFrame ? '60%' : false,
height: isIFrame ? '70%' : false,
iframe: isIFrame
});
});
});
})(jQuery);
</script>
Anbei noch ein Screenshot wie die Ausgabe im Frontend aussieht.
Lesezeichen