title: Pause setInterval on hover of Ajax Quick Cart and resume when not?
body: <p>I'm trying to set up my Ajax Quick Cart so that if the user is hovering over the quick cart (in other words interacting with it) it delays a setInterval that I have set on it to close the cart once something has been added after 3 seconds.</p>
  
  <p>I'm not that great with JS so any help would be appreciated!</p>
  
  <p>This is my original code:</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();
      });
  
      jQuery('body').on('click','#AddToCart', function(evt, cart) {
  
            timber.RightDrawer.open();
  
                var myVar = setInterval(function(){ 
                timber.RightDrawer.close();
                clearInterval(myVar);
                }, 3000);
      });
  </code></pre>
  
  <p>This is part of the original code I have tried to adapt to try to get it to work but still no luck, it just breaks my setInterval:</p>
  
  <pre><code>jQuery('body').on('click','#AddToCart', function(evt, cart) {
  
            timber.RightDrawer.open();
  
                $('#CartContainer').hover(function(ev){
                    clearInterval(myVar);
                }, function(ev){
                    myVar = setInterval(function(){ 
                    timber.RightDrawer.close();
                    clearInterval(myVar);
                    }, 3000);
                });
          });
  </code></pre>