Changeset 23029
- Timestamp:
- 12/04/2012 05:58:24 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r23028 r23029 1867 1867 container: document.body, 1868 1868 title: '', 1869 propagate: true 1869 propagate: true, 1870 freeze: document.body 1870 1871 }); 1871 1872 }, … … 1903 1904 1904 1905 open: function() { 1905 if ( this.$el.is(':visible') ) 1906 var $el = this.$el, 1907 options = this.options, 1908 $freeze; 1909 1910 if ( $el.is(':visible') ) 1906 1911 return this; 1907 1912 … … 1909 1914 this.attach(); 1910 1915 1911 this.$el.show().focus(); 1916 // If the `freeze` option is set, record the window's scroll 1917 // position and the body's overflow, and then set overflow to hidden. 1918 if ( options.freeze ) { 1919 $freeze = $( options.freeze ); 1920 this._freeze = { 1921 overflow: $freeze.css('overflow'), 1922 scrollTop: $( window ).scrollTop() 1923 }; 1924 $freeze.css( 'overflow', 'hidden' ); 1925 } 1926 1927 $el.show().focus(); 1912 1928 return this.propagate('open'); 1913 1929 }, 1914 1930 1915 1931 close: function( options ) { 1932 var freeze = this._freeze; 1933 1916 1934 if ( ! this.views.attached || ! this.$el.is(':visible') ) 1917 1935 return this; … … 1919 1937 this.$el.hide(); 1920 1938 this.propagate('close'); 1939 1940 // If the `freeze` option is set, restore the container's scroll 1941 // position and overflow property. 1942 if ( freeze ) { 1943 $( this.options.freeze ).css( 'overflow', freeze.overflow ); 1944 $( window ).scrollTop( freeze.scrollTop ); 1945 } 1921 1946 1922 1947 if ( options && options.escape )
Note: See TracChangeset
for help on using the changeset viewer.