0
Opa, I have to manipulate the scroll of a PDF document within an EMBED tag. It would be as follows, when opening the document, the ACCEPT button would be disabled and only when the user, scrolls the document 100% the button would be released. However, I’m not getting that final result. Follow the codes below, which I am using.
<!-- Modal -->
<div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel" style="color:black;">Termos e condições</h4>
</div>
<div class="modal-body" style="color:black;">
<div>
<embed class="frame-termo" id="termo"
src="https:soulpay.com.br/wp-content/uploads/2018/11/Contrato-de-Adesao-e-Credenciamento-SoulPay-alteracoes-novembro18-merged.pdf"
type="application/pdf"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id="btn-fechar" data-dismiss="modal">Cancelar</button>
<button id="botaoAceitar" type="button" class="btn btn-primary" value="Accept" data-dismiss="modal"
disabled>Aceitar</button>
</div>
</div>
</div>
</div>
Below follows the script I’m using.
<script type="text/javascript">
jQuery(function ($) {
$('#termo').on('scroll', function () {
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
$('#botaoAceitar').removeAttr('disabled');
}
})
});
</script>
There’s no way because you don’t have access to embed. A solution would be to use some PDF plugin, which can give access to scroll properties, or convert the pdf into image.
– Sam
and an IFRAME? there is the possibility of having access to an IFRAME?
– Gustavo Godoy
If you put the pdf directly tb does not give, because the browser creates an embed.
– Sam
The browser is designed to display HTML... when you put a PDF in it, it automatically creates an embed tag.
– Sam