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

1 Answer 1

0

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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