Making WordPress.org

Ticket #4519: 4519.diff

File 4519.diff, 1.7 KB (added by tellyworth, 4 years ago)
  • client/components/plugin/sections/faq/style.scss

     
    4343                                outline: none;
    4444                        }
    4545                }
     46                h3 {
     47                        display: inline;
     48                        text-transform: none;
     49                        margin-top: 0;
     50                        margin-bottom: 0;
     51                        color: $color__link;
     52                        text-decoration: underline;
     53                        button {
     54                                all: inherit;
     55                        }
     56                }
     57
    4658        }
    4759
    4860        dd {
  • js/section-faq.js

     
    44        questions
    55                .each( function( index, question ) {
    66                        var $question = $( question ),
    7                                 $button   = $( '<a href="#" />' ),
     7                                $button   = $( '<button />' ),
     8                                $h3       = $( '<h3 />' ),
    89                                id        = $question.attr( 'id' );
    910
    1011                        // If there is no ID, create our own.
     
    1314                                $question.attr( 'id', id );
    1415                        }
    1516
    16                         $button.attr( 'href', id ).on( 'click', function( event ) {
     17                        $button.attr( 'formaction', id ).on( 'click', function( event ) {
    1718                                event.preventDefault();
     19                                window.location.hash = id;
    1820                        } );
    1921
    20                         $question.html( $button.text( $question.text() ) );
     22                        $question.html( $h3.html( $button.text( $question.text() ) ) );
    2123                } )
    2224                .on( 'click', function( event ) {
    2325                        var $question = $( event.currentTarget );
     
    4042                } );
    4143
    4244        if ( window.location.hash ) {
    43                 questions.find( '[href="' + window.location.hash + '"]' ).trigger( 'click' );
     45                questions.find( '[formaction="' + window.location.hash + '"]' ).trigger( 'click' );
    4446        }
    4547} )( jQuery );