Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created March 13, 2010 13:55
Show Gist options
  • Save cowboy/331331 to your computer and use it in GitHub Desktop.
Save cowboy/331331 to your computer and use it in GitHub Desktop.
jQuery scrollable selector
/*!
* jQuery scrollable selector - v0.1 - 03/13/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
'$:nomunge'; // Used by YUI compressor.
var props = [ '', '-x', '-y' ],
re = /^(?:auto|scroll)$/i;
$.expr[':'].scrollable = function( elem ) {
var scrollable = false;
elem = $(elem);
$.each( props, function(i,v){
return !( scrollable = scrollable || re.test( elem.css( 'overflow' + v ) ) );
});
return scrollable;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment