Last active
May 21, 2022 10:14
-
-
Save wplit/4eb77f2ba19cf32cd681e23a78f1cc7c to your computer and use it in GitHub Desktop.
trigger offcanvas opening when item added to cart (add to code block and just change the class or ID to match your offcanvas)
This file contains 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($){ | |
let offCanvas = '.my-offcanvas'; // Change to your offcanvas selector (class or ID) | |
/* When item is added to cart */ | |
$( document.body ).on( 'added_to_cart', function(){ | |
/* Toggle the classes to open the offcanvas */ | |
$('html,body').addClass('off-canvas-toggled'); | |
$(offCanvas).addClass('oxy-off-canvas-toggled'); | |
$('.added_to_cart').remove(); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment