Changeset 4303
- Timestamp:
- 10/28/2016 06:32:52 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/section-accordion.js
r4223 r4303 13 13 } ); 14 14 15 $( '.read-more:not(' + sectionId + ')' ).removeClass( 'toggled' ).attr( 'aria-expanded', false ); 15 $( '.read-more:not(' + sectionId + ',.short-content)' ).removeClass( 'toggled' ).attr( 'aria-expanded', false ); 16 }, 17 initial_size: function( selector ) { 18 $( selector ).each( function( i, el) { 19 if ( $(el).height() / el.scrollHeight > 0.8 ) { 20 // Force the section to expand, and hide its button 21 $(el).toggleClass( 'toggled' ).addClass('short-content').attr( 'aria-expanded', true ); 22 $( '.section-toggle[aria-controls="' + el.id + '"]' ).hide(); 23 } else { 24 // Contract the section and make sure its button is visible 25 $(el).removeClass( 'short-content' ).attr( 'aria-expanded', false ); 26 $( '.section-toggle[aria-controls="' + el.id + '"]' ).show(); 27 } 28 } ); 16 29 } 17 30 }; … … 21 34 wporg.plugins.toggle( document.location.hash ); 22 35 } 36 37 wporg.plugins.initial_size( '.read-more' ); 23 38 24 39 $( window ).on( 'hashchange', function() {
Note: See TracChangeset
for help on using the changeset viewer.