jQuery code snippet to detect if a user has scrolled to the bottom of the page (or div with scroll) before enabling the terms and conditions checkbox.

Terms of service jargon stuff here
jQuery(document).ready(function() { jQuery("input#TERMS_ACCEPTED_YN").attr("disabled", true); var $box = $("#scrollPane"), $inner = $("> .inner", $box), innerOuterHeight = $inner.outerHeight(); boxHeight = $box.height(); boxOffsetTop = $box.offset().top; jQuery("#scrollPane").scroll(function() { if (Math.ceil(boxHeight - $inner.offset().top + boxOffsetTop) >= innerOuterHeight ) { jQuery("input#TERMS_ACCEPTED_YN").removeAttr("disabled"); } }); });
Tags: jquery detect bottom of page, jquery terms and conditions
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

No Reader comments

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.