I need to add Terms of Service Text Directly to Form but also that checkbox below is active to click only after scroll
May be possible ?
Hey Stefano,
Thank you for using Enfold.
You can use the “Description” element for the text. Use this css code to limit its height and hide the checkbox.
.av-form-text {
height: 300px;
overflow: auto;
width: 100%;
}
#element_avia_3_1 { opacity: 0; }
You can then add this script to enable the checkbox on scroll.
add_action('wp_footer', 'avf_enable_checkbox_scroll');
function avf_enable_checkbox_scroll(){
?>
<script type="text/javascript">
(function() {
const et = document.querySelector('.av-form-text');
if(et) {
et.addEventListener( 'scroll', (event) => {
var a = et.scrollTop;
var b = et.scrollHeight - et.clientHeight;
var c = a / b;
if( c >= 0.80 ) {
document.getElementById('element_avia_3_1').style.opacity= 1;
}
});
}
})();
</script>
<?php
}
Best regards,
Ismael