PHP Classes

File: assets/js/pdfobject-custom.js

Recommend this page to a friend!
  Classes of Uldis Nelsons  >  YII D3 PHP PDF Object  >  assets/js/pdfobject-custom.js  >  Download  
File: assets/js/pdfobject-custom.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: YII D3 PHP PDF Object
Embed PDF documents in HTML pages
Author: By
Last change:
Date: 3 years ago
Size: 1,312 bytes
 

Contents

Class file image Download
function embedPDF(url, target, options) { var pdf = PDFObject.embed(url, target, options); return pdf; } function listenOnClick(listenElSel, targetElSel, pdfOptions, callback) { $(document).ready(function () { var le = $(listenElSel), targetEl = $(targetElSel); $(le).on('click', function (e) { e.preventDefault(); var url = $(this).data('src'); if("undefined" == url) { console.log("Missing attribute for PDF source URL"); return false; } if("undefined" == targetEl) { console.log("Target element nor found: " + targetElSel); return false; } embedPDF(url, targetElSel, pdfOptions); var parentCollapsible = targetEl.parent(".collapse"); if("undefined" != parentCollapsible) { parentCollapsible.collapse('toggle'); } if("undefined" !== callback) { // @TODO - callback action } }); }); } $(document).ready(function () { $(".embed-pdf-close-button ").on('click', function (e) { e.preventDefault(); $(this).parent(".collapse").collapse('toggle'); }); });