Question

I have used default Magento 2 mini cart dropdown and my account dropdown it's working fine. But I'm facing the issue if we click my account tab mini cart dropdown still open I want to hide when we click my account tab.

Was it helpful?

Solution

Add below script in app/design/frontend/VENDOR/THEMENAME/Magento_Customer/templates/account/customer.phtml. this will solve your issue

<script type="text/javascript">
    requirejs(['jquery'], function($)
    {
        $('div.block.block-minicart').on('dropdowndialogopen',function () 
        {
            $('.customer-menu').attr('aria-hidden', 'true');
            $('.customer-welcome').removeClass('active');
            $('.customer-name').removeClass('active');
        });

        $(document).on('click.hideDropdown', function (e) 
        {
            $("div.block.block-minicart").dropdownDialog("close");
        });
    });
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top