Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check for scrollable element using jQuery.
* Test to get correct scrollable element
* @return {string}
* @see (updated to use $.scrollTop())
* @requires jquery 1.7+
getScrollable = function(){
var result = 'html, body',
$('html, body').each(function(){
var $this = $(this);
initScrollTop = $this.scrollTop();
$this.scrollTop(initScrollTop +1);
if($this.scrollTop() === initScrollTop + 1){
result = this.nodeName.toLowerCase();
return result;
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment