// ============= // ==== VAR ==== // ============= var $modalBoxTotal = 0; // =============== // ==== METOD ==== // =============== function percentToPix ($value) { return $value == null ? 0 : parseInt (screen.width * $value / 100); } function modalBoxLoad (content, $option) { var ID = $modalBoxTotal; $width = 80; $modalBoxId = 'modalBoxId-' + ID; $style = 'style="max-width:' + percentToPix ($width) + 'px;"'; var $modal = ''; $modalBoxTotal++; if ($('#duty').length == 0) { $('body').append('
'); } $('#duty').html($modal).promise().done(function() { $('#' + $modalBoxId) .modal('show') .on('hidden.bs.modal', function (e) { $(this).data('bs.modal', null); $('#' + $modalBoxId).remove(); window.modalBoxTotal--; }); }); } function modalBoxClose () { $('#modal').hide(); } function isModalBox () { return ($modalBoxTotal > 0) ? true : false; }