Hi Hans,
Try these instructions:
1. Install and activate the TC Custom JavaScript plugin.
2. Go To Appearance > Custom JavaScript.
3. Paste this jQuery code into the provided box. Use your own SVG icon in mySVGIcon variable.
4. Update and clear any cache.
Thread Starter
Hans K
(@hans-k)
Kharis, thank you for the quick reply.
I had seen this solution on the forum and had tried it before. But unfortunately it didn’t work.
And now I can’t get it to work either. I must have done something wrong.
This is what I did in the Custom JavaScript Plugin:
;(function($) {
'use strict'
if( $('#masthead-mobile .menu-toggle .sydney-svg-icon').length ) {
var mySVGIcon = '<svg enable-background="new 0 0 512 512" height="24" viewBox="0 0 512 512" width="24" xmlns="http://www.w3.org/2000/svg"><circle cx="256" cy="128" r="128"/><path d="m256 298.667c-105.99.118-191.882 86.01-192 192 0 11.782 9.551 21.333 21.333 21.333h341.333c11.782 0 21.333-9.551 21.333-21.333-.117-105.99-86.009-191.883-191.999-192z"/></svg>';
$('#masthead-mobile .menu-toggle .sydney-svg-icon').html(https://www.wiershoeck.nl/cms/wp-content/uploads/2022/03/Menu-hamburger-icoon.png);
}
})(jQuery);
Could you please tell me what I did wrong?
Thanks,
Hans
Hi Hans,
Thank you for getting back.
If you don’t want to use your own SVG icon, uninstall the plugin I suggested, and add this CSS code to Appearance > Customize > Additional CSS from dashboard.
#masthead-mobile .menu-toggle {
background-image: url('https://www.wiershoeck.nl/cms/wp-content/uploads/2022/03/Menu-hamburger-icoon.png');
background-repeat: no-repeat;
background-position: center center;
background-size: contain;
}
#masthead-mobile .menu-toggle * {
opacity: 0;
}
Thread Starter
Hans K
(@hans-k)
Hi Kharis,
I uploaded the wrong file the first time. The file I want to use instead of the hamburger menu is: https://www.wiershoeck.nl/cms/wp-content/uploads/2022/03/Menu.gif
I know how to get it there now, using the CSS code you suggested. It works, but it is too small and I can’t seem to get it much bigger.
If I change the background image size to “cover” or to a percentage, then it just shows one letter in stead of Menu
Could you please help me one last time?
Hans
Hi Hans,
Try this CSS code to enlarge your button.
#masthead-mobile .menu-toggle {
width: 40px;
height: 40px;
}
Hope that helps.
Thread Starter
Hans K
(@hans-k)
Hi Kharis,
It works, just like I wanted to!
Thank you very very much. You’re a great help on this forum!!
And you sure helped me!
All the best,
Hans