Skip to content

Instantly share code, notes, and snippets.

@tim-bec
Last active December 26, 2015 03:09
Show Gist options
  • Save tim-bec/7084187 to your computer and use it in GitHub Desktop.
Save tim-bec/7084187 to your computer and use it in GitHub Desktop.
Contao Colorbox width&height by andreasisaak
<?php
// Add the colorbox style sheet
$GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static';
?>
<script src="<?php echo TL_ASSETS_URL; ?>assets/jquery/colorbox/<?php echo COLORBOX; ?>/js/colorbox.min.js"></script>
<script>
(function($) {
$(document).ready(function() {
$('a[data-lightbox]').map(function() {
$(this).colorbox({
// Put custom options here
loop: false,
rel: $(this).attr('data-lightbox'),
maxWidth: '95%',
maxHeight: '95%',
'width': (($(this).data('width') !== undefined) ? $(this).data('width') : false),
'height': (($(this).data('height') !== undefined) ? $(this).data('height') : false)
});
});
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment