mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
6064a5e048
commit
72bfafbede
15
ui/core.js
15
ui/core.js
@ -32,6 +32,7 @@
|
||||
"./safe-active-element",
|
||||
"./safe-blur",
|
||||
"./tabbable",
|
||||
"./scroll-parent",
|
||||
"./version"
|
||||
], factory );
|
||||
} else {
|
||||
@ -43,20 +44,6 @@
|
||||
|
||||
// plugins
|
||||
$.fn.extend( {
|
||||
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;
|
||||
},
|
||||
|
||||
uniqueId: ( function() {
|
||||
var uuid = 0;
|
||||
|
@ -22,6 +22,7 @@
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core",
|
||||
"./version",
|
||||
"./keycode",
|
||||
"./widget",
|
||||
|
@ -20,12 +20,12 @@
|
||||
// AMD. Register as an anonymous module.
|
||||
define([
|
||||
"jquery",
|
||||
"./core",
|
||||
"./data",
|
||||
"./mouse",
|
||||
"./plugin",
|
||||
"./safe-active-element",
|
||||
"./safe-blur",
|
||||
"./scroll-parent",
|
||||
"./version",
|
||||
"./widget"
|
||||
], factory );
|
||||
|
42
ui/scroll-parent.js
Normal file
42
ui/scroll-parent.js
Normal file
@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* jQuery UI Scroll Parent @VERSION
|
||||
* 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;
|
||||
};
|
||||
|
||||
} ) );
|
@ -22,9 +22,10 @@
|
||||
"jquery",
|
||||
"./core",
|
||||
"./data",
|
||||
"./version",
|
||||
"./ie",
|
||||
"./mouse",
|
||||
"./version",
|
||||
"./scroll-parent",
|
||||
"./widget"
|
||||
], factory );
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user