WooCommerce mini cart fragments click event

I’m trying to add click event to the WooCommerce cart icon. However it doesn’t work I guess because of the WooCommerce Ajax fragments. I want to keep Ajax fragments active and just add click event on the icon.

PHP:

if ( ! function_exists( 'arendelle_woo_cart_icon' ) ) {     function arendelle_woo_cart_icon() {          if ( ! arendelle_is_woocommerce_activated() ) {             return;         }          $  count = WC()->cart->get_cart_contents_count();         ?>          <div class="arendelle-menu-cart woocommerce">             <a class="arendelle-menu-cart__url arendelle-offcanvas-js-trigger" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php echo esc_attr__( 'View my shopping cart', 'arendelle' ); ?>">                 <span class="arendelle-menu-cart__icon-holder">                     <i class="arendelle-icon-cart arendelle-menu-cart__icon"></i>                     <?php if ( 0 < $  count ) : ?>                         <span class="arendelle-menu-cart__count"><?php echo esc_html( $  count ); ?></span>                     <?php endif; ?>                 </span>             </a>              <?php if ( 0 < $  count ) {                 echo '<div class="arendelle-offcanvas">';                     echo '<div class="arendelle-offcanvas__panel">';                         woocommerce_mini_cart();                     echo '</div>';                     echo '<div class="arendelle-offcanvas__overlay elementor-clickable"></div>';                 echo '</div>';             } ?>         </div>         <?php      } } 

JS

    cartOffcanvas: function() {         let trigger = document.querySelector('.arendelle-offcanvas-js-trigger');         let panel = document.querySelector('.arendelle-offcanvas__panel');         let overlay = document.querySelector('.arendelle-offcanvas__overlay');           console.log(trigger);          trigger.addEventListener('click', function(e) {             e.preventDefault();             e.stopImmediatePropagation();              console.log('clicked');             panel.classList.add('arendelle-offcanvas__panel--is-open');                  });      },