title: How to close a Shopify Ajax Cart on scroll?
body: <p>I've successfully set up the Shopify Ajax Cart using the <a href="http://www.timber-demo.myshopify.com" rel="nofollow">Timber framework</a> so currently my cart closes if you click anywhere outside of the cart (or using the close button).</p>
  
  <p>I was wondering if it was possible to have the cart close should the user start to scroll after they have added an item to the cart. I found another theme - <a href="http://www.beatnik-5.myshopify.com" rel="nofollow">Beatnik</a> - which achieves this but not being great with JS, I'm not sure where to begin.</p>
  
  <p>I've realised that when the cart is open the rest of the site isn't scrollable so I'm wondering if this is why I'm having trouble getting it to scroll?</p>
  
  <p>Some of my current code as follows, see Timber framework for same setup as mine:</p>
  
  <p>theme.liquid - </p>
  
  <pre><code>{% comment %}
  Ajaxify your cart with this plugin.
  Documentation:
      - http://shopify.com/timber#ajax-cart
  {% endcomment %}
  {% if settings.ajax_cart_enable %}
    {{ 'handlebars.min.js' | asset_url | script_tag }}
    {% include 'ajax-cart-template' %}
    {{ 'ajax-cart.js' | asset_url | script_tag }}
    &lt;script&gt;
      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();
      });
  
  //Something I have tried...
  
      $(window).on('scroll', function() {
      // when timer is triggered:
      timber.rightDrawer.close();
      });
  &lt;/script&gt;
  {% endif %}
  </code></pre>
  
  <p>Any help would be really appreciated!</p>