3

How can we close the mini cart popup on Magento 2? (clicking outside is not working). I have already tried the following method on footer.phtml. It's working on android phones and browsers but iPhones, it is not working.

<script>
   require(['jquery', 'jquery/ui'], function($){
     jQuery(document).ready( function() {

      $('body').click(function (event)
      {
         element = $(event.target);
         if(element.parents('.skip-link.skip-cart').length1 || element.hasClass('skip-cart'))
           {
             return;
           }

           var parent = $('.minicart-wrapper').parents('.skip-content');
           var link = parent.siblings('.skip-link');

         if (element.parents('.minicart-wrapper').length == 0)
           {
             parent.removeClass('skip-active');
             link.removeClass('skip-active');
           }
      });
    });
  });
</script>

Minicart Popup

0

In your footer.phtml above with your jquery, just add this:

<body style="cursor: pointer;" onclick="">
</body>
  • 1
    Now It's working. Thanks for the help – Fed May 24 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.