William Costa Rodrigues - Site Developer

Site pessoal, com postagens, desenhos, códigos, informações sobre ciências e tecnologia.

Home Novidades Postagens
Categoria
Códigos adicionados no site: 18
Temas para Código

Abertura arquivo pdf em Dialog Modal (BS e JQuery)

Palavras-chaves: JQuery, Bootstrap, Javascript, PDF, | JavaScript
Cadastro: 14/10/2025 00:18:22 | Atualização: 14/10/2025 00:21:02
/*
Utiliza bootstrap v 5.X e Jquery v3.7.X
*/
(function (a) {
    a.createModal = function (b) {
        defaults = { title: "", message: "Leitor de PDF", closeButton: true, scrollable: false };
        var b = a.extend({}, defaults, b);
        var c = (b.scrollable === true) ? 'style="min-width: 600px; max-height: 620px;overflow-y: auto;"' : "";
        html = '";
        a("body").prepend(html);
        a("#ModalPDF").modal().on("hidden.bs.modal", function () { a(this).remove() })
    }
})(jQuery);


$(function () {
    $('.view-pdf').on('click', function () {
        var pdf_link = $(this).attr('href');     
        var iframe = 'No Support'
        $.createModal({
            title: 'Leitor de PDF Plugin',
            message: iframe,
            closeButton: true,
            scrollable: false
        });
        return false;
    });
})