Created
June 18, 2020 14:32
-
-
Save colmtroy/638557a7e14527eda967a0a8f4b7230f to your computer and use it in GitHub Desktop.
jquery test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
( 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