| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
( function( factory ) { |
| 16 |
"use strict"; |
| 17 |
|
| 18 |
if ( typeof define === "function" && define.amd ) { |
| 19 |
|
| 20 |
|
| 21 |
define( [ "jquery", "./version" ], factory ); |
| 22 |
} else { |
| 23 |
|
| 24 |
|
| 25 |
factory( jQuery ); |
| 26 |
} |
| 27 |
} )( function( $ ) { |
| 28 |
"use strict"; |
| 29 |
|
| 30 |
return $.fn.scrollParent = function( includeHidden ) { |
| 31 |
var position = this.css( "position" ), |
| 32 |
excludeStaticParent = position === "absolute", |
| 33 |
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, |
| 34 |
scrollParent = this.parents().filter( function() { |
| 35 |
var parent = $( this ); |
| 36 |
if ( excludeStaticParent && parent.css( "position" ) === "static" ) { |
| 37 |
return false; |
| 38 |
} |
| 39 |
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + |
| 40 |
parent.css( "overflow-x" ) ); |
| 41 |
} ).eq( 0 ); |
| 42 |
|
| 43 |
return position === "fixed" || !scrollParent.length ? |
| 44 |
$( this[ 0 ].ownerDocument || document ) : |
| 45 |
scrollParent; |
| 46 |
}; |
| 47 |
|
| 48 |
} ); |