Ticket #48916: 48916.diff
File 48916.diff, 911 bytes (added by , 5 years ago) |
---|
-
src/wp-content/themes/twentytwenty/assets/js/index.js
137 137 var target = event.target; 138 138 var modal = document.querySelector( '.cover-modal.active' ); 139 139 140 // if target onclick is <a> with # within the href attribute 141 if ( event.target.tagName.toLowerCase() === 'a' && event.target.hash.includes( '#' ) && modal !== null ) { 142 // untoggle the modal 143 this.untoggleModal( modal ); 144 // wait 550 and scroll to the anchor 145 setTimeout( function() { 146 var anchor = document.getElementById( event.target.hash.slice( 1 ) ); 147 anchor.scrollIntoView(); 148 }, 550 ); 149 } 150 140 151 if ( target === modal ) { 141 152 this.untoggleModal( target ); 142 153 }