ここで何が起こったのか論理的に理解できません。誰か助けてもらえますか??
// heynow.js
$(document).ready(function() {
// on the checkbox disable it right away
$('#agree').attr('disabled', 'disabled');
//on the terms box add a scroll function
$('#terms').scroll(function() {
// textareheight equals scrollheight not accurate
var textareaheight = $(this).[0].scrollHeight;
// scrollheight equals scrollheight – the innerheight which is more accurate and dynamic
var scrollheight = textareaheight - $(this).innerHeight();
// scrolltop equals scrolltop returning where are you
var scrolltop = $(this).scrollTop();
// if where you at equals the total height
if (scrolltop == scrollheight) {
// then enable the checkbox
$('#agree').removeAttr('disabled');
}
});
});
<!-- html file -->
<p><textarea id="terms">lots of text for a scroll avail</textarea></p>
<p><input id="agree" type="checkbox" /> I Agree</p>