diff --git a/src/wp-content/themes/twentytwenty/assets/js/index.js b/src/wp-content/themes/twentytwenty/assets/js/index.js
index f5b142d239..f272a6f953 100644
|
a
|
b
|
twentytwenty.coverModals = { |
| 169 | 169 | // Hide and show modals before and after their animations have played out. |
| 170 | 170 | hideAndShowModals: function() { |
| 171 | 171 | var _doc = document, |
| 172 | | _win = window, |
| 173 | | modals = _doc.querySelectorAll( '.cover-modal' ), |
| 174 | | htmlStyle = _doc.documentElement.style, |
| 175 | | adminBar = _doc.querySelector( '#wpadminbar' ); |
| 176 | | |
| 177 | | function getAdminBarHeight( negativeValue ) { |
| 178 | | var height, |
| 179 | | currentScroll = _win.pageYOffset; |
| 180 | | |
| 181 | | if ( adminBar ) { |
| 182 | | height = currentScroll + adminBar.getBoundingClientRect().height; |
| 183 | | |
| 184 | | return negativeValue ? -height : height; |
| 185 | | } |
| 186 | | |
| 187 | | return currentScroll === 0 ? 0 : -currentScroll; |
| 188 | | } |
| 189 | | |
| 190 | | function htmlStyles() { |
| 191 | | var overflow = _win.innerHeight > _doc.documentElement.getBoundingClientRect().height; |
| 192 | | |
| 193 | | return { |
| 194 | | 'overflow-y': overflow ? 'hidden' : 'scroll', |
| 195 | | position: 'fixed', |
| 196 | | width: '100%', |
| 197 | | top: getAdminBarHeight( true ) + 'px', |
| 198 | | left: 0 |
| 199 | | }; |
| 200 | | } |
| | 172 | modals = _doc.querySelectorAll( '.cover-modal' ); |
| 201 | 173 | |
| 202 | 174 | // Show the modal. |
| 203 | 175 | modals.forEach( function( modal ) { |
| 204 | 176 | modal.addEventListener( 'toggle-target-before-inactive', function( event ) { |
| 205 | | var styles = htmlStyles(), |
| 206 | | offsetY = _win.pageYOffset, |
| 207 | | paddingTop = ( Math.abs( getAdminBarHeight() ) - offsetY ) + 'px', |
| 208 | | mQuery = _win.matchMedia( '(max-width: 600px)' ); |
| 209 | 177 | |
| 210 | 178 | if ( event.target !== modal ) { |
| 211 | 179 | return; |
| 212 | 180 | } |
| 213 | 181 | |
| 214 | | Object.keys( styles ).forEach( function( styleKey ) { |
| 215 | | htmlStyle.setProperty( styleKey, styles[ styleKey ] ); |
| 216 | | } ); |
| 217 | | |
| 218 | | _win.twentytwenty.scrolled = parseInt( styles.top, 10 ); |
| 219 | | |
| 220 | | if ( adminBar ) { |
| 221 | | _doc.body.style.setProperty( 'padding-top', paddingTop ); |
| 222 | | |
| 223 | | if ( mQuery.matches ) { |
| 224 | | if ( offsetY >= getAdminBarHeight() ) { |
| 225 | | modal.style.setProperty( 'top', 0 ); |
| 226 | | } else { |
| 227 | | modal.style.setProperty( 'top', ( getAdminBarHeight() - offsetY ) + 'px' ); |
| 228 | | } |
| 229 | | } |
| 230 | | } |
| 231 | | |
| 232 | 182 | modal.classList.add( 'show-modal' ); |
| 233 | 183 | } ); |
| 234 | 184 | |
| 235 | 185 | // Hide the modal after a delay, so animations have time to play out. |
| 236 | 186 | modal.addEventListener( 'toggle-target-after-inactive', function( event ) { |
| | 187 | |
| 237 | 188 | if ( event.target !== modal ) { |
| 238 | 189 | return; |
| 239 | 190 | } |
| 240 | 191 | |
| 241 | 192 | setTimeout( function() { |
| 242 | | var clickedEl = twentytwenty.toggles.clickedEl; |
| 243 | 193 | |
| 244 | 194 | modal.classList.remove( 'show-modal' ); |
| 245 | 195 | |
| 246 | | Object.keys( htmlStyles() ).forEach( function( styleKey ) { |
| 247 | | htmlStyle.removeProperty( styleKey ); |
| 248 | | } ); |
| 249 | | |
| 250 | | if ( adminBar ) { |
| 251 | | _doc.body.style.removeProperty( 'padding-top' ); |
| 252 | | modal.style.removeProperty( 'top' ); |
| 253 | | } |
| 254 | | |
| 255 | | if ( clickedEl !== false ) { |
| 256 | | clickedEl.focus(); |
| 257 | | clickedEl = false; |
| 258 | | } |
| 259 | | |
| 260 | | _win.scrollTo( 0, Math.abs( _win.twentytwenty.scrolled + getAdminBarHeight() ) ); |
| 261 | | |
| 262 | | _win.twentytwenty.scrolled = 0; |
| 263 | 196 | }, 500 ); |
| 264 | 197 | } ); |
| 265 | 198 | } ); |
diff --git a/src/wp-content/themes/twentytwenty/style.css b/src/wp-content/themes/twentytwenty/style.css
index 3ee6dbc431..71fa2c0e14 100644
|
a
|
b
|
ul.social-icons li { |
| 1333 | 1333 | |
| 1334 | 1334 | /* Cover Modals ------------------------------ */ |
| 1335 | 1335 | |
| | 1336 | body.showing-modal { |
| | 1337 | overflow: hidden; |
| | 1338 | } |
| | 1339 | |
| 1336 | 1340 | .cover-modal { |
| 1337 | 1341 | display: none; |
| 1338 | 1342 | -ms-overflow-style: none; |
| … |
… |
ul.social-icons li { |
| 1346 | 1350 | .cover-modal.show-modal { |
| 1347 | 1351 | display: block; |
| 1348 | 1352 | cursor: pointer; |
| | 1353 | position: fixed; |
| | 1354 | height: 100%; |
| | 1355 | width: 100%; |
| | 1356 | overflow-x: hidden; |
| | 1357 | overflow-y: auto; |
| 1349 | 1358 | } |
| 1350 | 1359 | |
| 1351 | 1360 | .cover-modal.show-modal > * { |