I have a registration form which contains a read-only textarea. I want to require any visitor to scroll to the bottom of the textarea, which contains terms and conditions or
I recommend this rather, it handles zooming better.
$('#terms').scroll(function () {
if ($(this).scrollTop() + $(this).innerHeight() +2 >= $(this)[0].scrollHeight) {
$('#register').removeAttr('disabled');
}
});
The +2 handles a few scaling scenarios when scrolltop+innerheight is marginally below scrollHeight (for some reason I am too lazy to work out).