mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Core: provide "includeHidden" parameter in $.ui.scrollParent
Even though the user is unable to scroll via the UI, authors may have custom scrollbars that programmatically set scrollTop. Therefore, overflow:hidden can be considered a scrollParent.
This commit is contained in:
parent
2ac0769967
commit
67e4b44b29
@ -48,15 +48,16 @@ $.extend( $.ui, {
|
||||
|
||||
// plugins
|
||||
$.fn.extend({
|
||||
scrollParent: function() {
|
||||
scrollParent: function( includeHidden ) {
|
||||
var position = this.css( "position" ),
|
||||
excludeStaticParent = position === "absolute",
|
||||
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
|
||||
scrollParent = this.parents().filter( function() {
|
||||
var parent = $( this );
|
||||
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
|
||||
return false;
|
||||
}
|
||||
return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
|
||||
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
|
||||
}).eq( 0 );
|
||||
|
||||
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
|
||||
|
Loading…
Reference in New Issue
Block a user