我正试图允许用户单击一个元素,然后让div提出一个包含pdf的对象。所有代码都可以在Chrome上运行,但是在ios上的Safari上,该对象不会出现。嵌入标签也没有。如何让pdf显示在ios上?
html:
<div class="document-holder" id="offense-incident">
<img src="img/incident.jpg" class="embedded-pdf" />
<p class="pic-caption side-cap"><i class="fas fa-search-plus zoom"></i>1978 police report</p>
</div>
<lightbox>
<div class="close"><i class="fas fa-times-circle"></i></div>
</lightbox>
jquery:
$('.document-holder').on('tap', function() {
var thisID = $(this).attr('id');
//$('lightbox').remove('embed');
//$('lightbox').remove('object');
$('object').remove();
//<embed src="" type="application/pdf" class="pdf-doc" style="width: 100%; height: 100%;" />
if ( $(this).attr('id') ) {
//var newEmbed = "<embed type='application/pdf' class='pdf-doc' src='pdf/" + thisID + ".pdf' />";
//var newEmbed = "<object style='width: 100%; height: 90%;' type='application/pdf' data='pdf/" + thisID + ".pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0'><p></p></object>";
//$('lightbox').append(newEmbed);
$('lightbox').append("<object style='width: 100%; height: 90%;' type='application/pdf' data='pdf/" + thisID + ".pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0'><p></p></object>");
$('lightbox').css('z-index','6');
$('lightbox, mask').fadeIn();
}
});