Functionality:
User has to scroll and read through the TnC(Terms & Condition) Page before being allowed to click "Next" to proceed to the next page.
Hence, if user does not read through the TnC and clicks "Next", a prompt will be displayed "Please scroll and read TnC before proceeding". Else, when user has scrolled the TnC, user will be able to click "Next" to proceed to the next page.
What has been done:
I have set a conditional check for the following container if it is scrolled, if scroll, it will then allow user to click "Next" and proceed to the enxt page, else if scroll is not checked, it will display the prompt message.
Issue:
I am not able to get the check condition correct as when user clicks on the "NEXT" button, it will still bring the user to the next page.
I may have done it wrongly, hence, may I seek some help? Thanks
function AgreeTnC() {
//Conditional check user has scrolled the T&C
if ($.trim($("#TermsNCondition").is(':scrolled'))) {
$('#TnC').fadeOut({
duration: slideDuration,
queue: false
});
$('#QnA').fadeIn({
duration: slideDuration,
queue: false
});
} else {
console.log("READTNC");
$("#READTNC").html("Please Do Read Through Terms & Condition Before Proceeding.");
$("#READTNC").fadeIn();
}
}
<div id="TnC" align="center" style="position:absolute; width:1920px; height:1080px; background-repeat: no-repeat; display: none; z-index=2; top:0px; left:0px; ">
<div id="READTNC" style="z-index:2; position:absolute; top:950px; left:750px; display: none; font-size:30px; font-family:'CenturyGothic'; width:1080; color:#fff;"><font face="CenturyGothic">Please Do Read Through Terms & Condition Before Proceeding.</font>
</div>
<div id="TermsNCondition" class="Container">
<div class="innerScroll">
<div class="context">
<p><font face="CenturyGothic">TEST TERMS & CONDITION TEXT</font>
</p>
</div>
</div>
</div>
<button id="Agree" onclick="AgreeTnC()"></button>
<button id="Back" onclick="PreviousMainPage()"></button>
</div>