Skip to content

Instantly share code, notes, and snippets.

@colmtroy
Created June 18, 2020 14:32
Show Gist options
  • Save colmtroy/638557a7e14527eda967a0a8f4b7230f to your computer and use it in GitHub Desktop.
Save colmtroy/638557a7e14527eda967a0a8f4b7230f to your computer and use it in GitHub Desktop.
jquery test
;
( function( $ ) {
'use strict';
// Add close drawer markup
$( '.post-type-archive-product #secondary' ).prepend( '<div class="close-drawer"></div>' );
// Add custom id to the single product form
$( document ).ready( function() {
$( '.single-product form.cart' ).attr( 'id', 'sticky-scroll' );
} );
// Toggle cart drawer.
$( document ).on( 'click', '.mobile-filter', function( e ) {
e.stopPropagation();
e.preventDefault();
$( 'body' ).toggleClass( 'filter-open' );
} );
// Add a class if term description text or an image exists.
if ( 0 < $( '.term-description' ).length ) {
$( '.woocommerce-products-header' ).addClass( 'description-exists' );
}
}( jQuery ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment