/* * Pour parametrer la largeur : * Indiquer le data-width sur le lien (exmeple data-width= "90") * Imposer le style sur le premier bloc englobant dans la madiabox (style="width: [(#ENV{largeur})]) */ jQuery(function () { modalbox(); function modalbox() { $('body').on('click', '.modalbox, .modalgamutable', function (e) { e.stopPropagation(); e.preventDefault(); let ts = + new Date() let url = $(this).attr('href'); url += '&var_zajax=content'; url += '&ts=' + ts; let data = {}; let minHeight = $(this).data('minheight'); let minWidth = $(this).data('minwidth'); if (minHeight !== undefined) { data.minHeight = minHeight; } if (minWidth !== undefined) { data.minWidth = minWidth; } let width = $(this).data('width'); if (width !== undefined) { data.width = width; let valeur_reduite = ($(window).width() * width) / 100; url += '&largeur=' + valeur_reduite + 'px'; } let that = this; data.onShow = () => { if (typeof charger_require !== undefined) { charger_require(); } if ($(that).hasClass('modalgamutable')) { if (typeof window.gamutable !== 'undefined') { window.gamutable(); } } }; $.modalbox(url, data); }); } });