Prevent selected payment method description box from sliding up

Closes #21770
This commit is contained in:
Mike Jolley 2019-01-15 12:14:55 +00:00
parent 507f67cb38
commit ec1d44c742
1 changed files with 4 additions and 2 deletions

View File

@ -77,10 +77,12 @@ jQuery( function( $ ) {
$payment_methods.eq(0).prop( 'checked', true );
}
if ( $payment_methods.length > 1 ) {
// Get name of new selected method.
var checkedPaymentMethod = $payment_methods.filter( ':checked' ).eq(0).prop( 'id' );
if ( $payment_methods.length > 1 ) {
// Hide open descriptions.
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 0 );
$( 'div.payment_box:not(".' + checkedPaymentMethod + '")' ).filter( ':visible' ).slideUp( 0 );
}
// Trigger click event for selected method