Fix deprecated jQuery removeClass function
This commit is contained in:
parent
387e095a01
commit
b78aa4e00a
|
@ -34,17 +34,23 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
$( function() {
|
||||
// Prevent inputs in meta box headings opening/closing contents.
|
||||
$( '#woocommerce-product-data' ).find( '.hndle' ).off( 'click.postboxes' );
|
||||
var woocommerce_product_data = $( '#woocommerce-product-data' );
|
||||
|
||||
$( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) {
|
||||
// Prevent inputs in meta box headings opening/closing contents.
|
||||
woocommerce_product_data.find( '.hndle' ).off( 'click.postboxes' );
|
||||
|
||||
woocommerce_product_data.on( 'click', '.hndle', function( event ) {
|
||||
|
||||
// If the user clicks on some form input inside the h3 the box should not be toggled.
|
||||
if ( $( event.target ).filter( 'input, option, label, select' ).length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( '#woocommerce-product-data' ).toggleClass( 'closed' );
|
||||
if ( woocommerce_product_data.hasClass( 'closed' ) ) {
|
||||
woocommerce_product_data.removeClass( 'closed' );
|
||||
} else {
|
||||
woocommerce_product_data.addClass( 'closed' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,19 @@ jQuery( function ( $ ) {
|
|||
runTipTip();
|
||||
|
||||
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() {
|
||||
$( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' );
|
||||
var metabox = $( this ).parent( '.wc-metabox' );
|
||||
|
||||
if ( metabox.hasClass( 'closed' ) ) {
|
||||
metabox.removeClass( 'closed' );
|
||||
} else {
|
||||
metabox.addClass( 'closed' );
|
||||
}
|
||||
|
||||
if ( metabox.hasClass( 'open' ) ) {
|
||||
metabox.removeClass( 'open' );
|
||||
} else {
|
||||
metabox.addClass( 'open' );
|
||||
}
|
||||
});
|
||||
|
||||
// Tabbed Panels
|
||||
|
|
|
@ -139,7 +139,14 @@ jQuery( function( $ ) {
|
|||
} );
|
||||
|
||||
$( '.wc-wizard-services-list-toggle' ).on( 'click', function() {
|
||||
$( this ).closest( '.wc-wizard-services-list-toggle' ).toggleClass( 'closed' );
|
||||
var listToggle = $( this ).closest( '.wc-wizard-services-list-toggle' );
|
||||
|
||||
if ( listToggle.hasClass( 'closed' ) ) {
|
||||
listToggle.removeClass( 'closed' );
|
||||
} else {
|
||||
listToggle.addClass( 'closed' );
|
||||
}
|
||||
|
||||
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
|
||||
.slideToggle()
|
||||
.css( 'display', 'flex' );
|
||||
|
|
Loading…
Reference in New Issue