0

https://imprint-aftercare.myshopify.com/
以 Timber 为基础构建了一个主题。单击“添加到购物车”成功添加到购物车并用购物车填充滑出抽屉......但是,单击购物车图标会使抽屉滑出,但根本不显示购物车。我走了在这个代码上重复了几十次,并与我在哪里编码的商店进行比较,但无法弄清楚。帮助!

编辑:根据要求,这是相关代码

<div id="CartDrawer" class="drawer drawer--right">
    <div class="drawer__header">
      <div class="drawer__title h3">your cart</div>
      <div class="drawer__close js-drawer-close">
        <button type="button" class="icon-fallback-text">
          <span class="icon icon-x"></span>          
        </button>
      </div>
    </div>
    <div id="CartContainer"></div>
</div>





{{ 'footer.js' | asset_url | script_tag }}
{{ 'fastclick.min.js' | asset_url | script_tag }}
{{ 'timber.js' | asset_url | script_tag }}
{% include 'ajax-cart-template' %}
{{ 'ajax-cart.js' | asset_url | script_tag }}
<script>
  jQuery(function($) {
    ajaxCart.init({
      formSelector: '#AddToCartForm',
      cartContainer: '#CartContainer',
      addToCartSelector: '#AddToCart',
      cartCountSelector: '#CartCount',
      cartCostSelector: '#CartCost',
      moneyFormat: {{ shop.money_format | json }}
    });
  });

 jQuery('body').on('ajaxCart.afterCartLoad', function(evt, cart) {
    // Bind to 'ajaxCart.afterCartLoad' to run any javascript after the cart has loaded in the DOM
    timber.RightDrawer.open();
   ajaxCart.init({
      formSelector: '#AddToCartForm',
      cartContainer: '#CartContainer',
      addToCartSelector: '#AddToCart',
      cartCountSelector: '#CartCount',
      cartCostSelector: '#CartCost',
      moneyFormat: {{ shop.money_format | json }}
    });
  });
4

0 回答 0