Assistant
These methods allow you to interact with the "Assistant" modal. Which is an overlay on top of the Drawer, which is used whenever additional information is required, such as a change of billing address. You typically don't have to interact with this API, unless you're creating your own Assistant instance.
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.
show()
Open a specific Assistant modal.
🛠 Method
Argument | Type | Description |
---|---|---|
element | HTMLElement | The HTML element to show. |
CartPops.assistant.show(element);
🌈 Example
jQuery( document).ready( function( $ ){
$( '#your-element' ).on( 'click' , function(ev) {
ev.preventDefault()
const btn = ev.target
const content = btn.getAttribute('data-assistant')
if (content === 'my-modal') {
CartPops.assistant.show(content)
}
});
});
hide()
Hide all Assistant modals.
🛠 Method
CartPops.assistant.hide();
🌈 Example
jQuery( document).ready( function( $ ){
$( '#your-element' ).on( 'click' , function() {
CartPops.assistant.hide();
});
});