[英]When click download button show popup and go to download PDF
I want to add popup before going to download pdf in my wordpress site.我想在我的 wordpress 网站中下载 pdf 之前添加弹出窗口。 I try to add contact form 7 event listener but it's not working.
我尝试添加联系表单 7 事件侦听器,但它不起作用。 Any idea??
任何的想法??
<p class="margin-xs-top20"><?php
if( get_field('download') ): ?>
<button data-toggle="modal" data-target="#myModal" type="file" class="btn btn-default btn-lg btn-primary btn-huge">download publication
<script>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '4265' == event.detail.contactFormId ) { // Sends sumissions on form 4265 to the first thank you page
var pdfLink = '[DOMAIN]/wp/wp-content/uploads/2018/06/file.pdf';
} else if ( '4266' == event.detail.contactFormId ) { // Sends submissions on form 1070 to the second thank you page
var pdfLink = '[DOMAIN]/wp/wp-content/uploads/2018/06/file2.pdf';
}
else {
//do nothing
}
jQuery.get(pdfLink, (data) ->
window.location.href = jQuery(this).attr('href');
)
}, false );
</script>
</script></button>
<?php endif; ?></p>
You should have tried to WP Post Popup WordPress plugin.您应该尝试过WP Post Popup WordPress 插件。 Maybe you get what you want in your WordPress site
也许你在你的 WordPress 网站上得到了你想要的东西
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.