magento 2 mini cart dropdown hide if we click on my account tab
-
11-04-2021 - |
質問
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.
解決
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>
所属していません magento.stackexchange