Last active
December 26, 2015 03:09
-
-
Save tim-bec/7084187 to your computer and use it in GitHub Desktop.
Contao Colorbox width&height by andreasisaak
This file contains 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 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