Changeset 6494
- Timestamp:
- 01/31/2018 11:37:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/section-faq.js
r6285 r6494 1 1 ( function( $ ) { 2 2 var questions = $( 'dt', '#faq' ); 3 var hash = window.location.hash.replace( /[^a-z0-9-#]/gi, '' );4 3 5 4 questions … … 11 10 // If there is no ID, create our own. 12 11 if ( ! id ) { 13 id = '#' + $question.text().toLowerCase().replace( /[^\w\s]/gi, '' ).replace( /\s/gi, '-');12 id = '#' + encodeURIComponent( $question.text().toLowerCase() ); 14 13 $question.attr( 'id', id ); 15 14 } … … 36 35 } ).next( 'dd' ).slideToggle( 200 ); 37 36 38 if ( hash ) {37 if ( window.location.hash ) { 39 38 window.scrollTo( 0, $question.offset().top ); 40 39 } 41 40 } ); 42 41 43 if ( hash ) {44 questions.find( '[href="' + hash + '"]' ).trigger( 'click' );42 if ( window.location.hash ) { 43 questions.find( '[href="' + window.location.hash + '"]' ).trigger( 'click' ); 45 44 } 46 45 } )( jQuery );
Note: See TracChangeset
for help on using the changeset viewer.