Created
March 13, 2010 13:55
-
-
Save cowboy/331331 to your computer and use it in GitHub Desktop.
jQuery scrollable selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* 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