Skip to main content

Drawer

These methods allow you to interact with the Drawer.

note

Please keep in mind that the CartPops API is subject to change. Before updating, please check the changelog to learn what has changed and whether you can safely upgrade.

.on('show', ...)

This event fires after the user opened the Drawer via the CartPops Launcher, by clicking the add to cart button or when the Drawer opens programmatically — for example with a Javascript method.

🛠 Arguments

ArgumentTypeDescription
drawerobjectHolds the drawer with all options and properties.

🌈 Example

jQuery(function($) {
CartPops.drawer.on( 'show', function( drawer ) {
// Do something here 🦄
} );
});

.on('hide', ...)

This event fires after the user dismissed the Drawer via a button, by clicking the Drawer overlay, by pressing the escape key, or when the Drawer closes progammaticaly — for example with a Javascript method.

🛠 Arguments

ArgumentTypeDescription
drawerobjectHolds the drawer with all options and properties.

🌈 Example

jQuery(function($) {
CartPops.drawer.on( 'hide', function( drawer ) {
// Do something here 🦄
} );
});