Hi I am working on a Shopify website. i want the hamburger menu to change to cross on click, I have tried everything but it is not working. i have two different images one hamburger and another is cross. and I have given them two different classes as well
Site URL:"https://9q49gu54zvkaspm1-18691129395.shopifypreview.com/"
Please help
if($('body').hasClass(".show-mobile-nav"))
{
$('img.close').hide();
}
else($('body').hasClass(""))
{
$("img.open").show();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
here is the code I have tried
2
Answers
You could try doing something like this. Just have a span, and you make the two other bars with
::before
and::after
Here is a codepen
This should work:
Of course it should be a in function where it is called when the page is loaded and when the user clicks on the said button.