mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-28 23:19:42 -08:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/*!
|
|
* jQuery UI Scroll Parent 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
|
|
//>>label: scrollParent
|
|
//>>group: Core
|
|
//>>description: Get the closest ancestor element that is scrollable.
|
|
//>>docs: http://api.jqueryui.com/scrollParent/
|
|
|
|
( function( factory ) {
|
|
if ( typeof define === "function" && define.amd ) {
|
|
|
|
// AMD. Register as an anonymous module.
|
|
define( [ "jquery", "./version" ], factory );
|
|
} else {
|
|
|
|
// Browser globals
|
|
factory( jQuery );
|
|
}
|
|
} ( function( $ ) {
|
|
|
|
return $.fn.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 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;
|
|
};
|
|
|
|
} ) );
|