Home › Forums › Jevelin Theme › Mobile anchor navbar close
Home › Forums › Jevelin Theme › Mobile anchor navbar close
How can I modify the scripts.js or something else to make the dropdown navbar toggle close automatic when click on an acnhor link? One-page style?
I see this in the scripts.js but doesnt work..
https://bjrd.hu – this is my site, please check the anchor menu items and the hamburger menu
/* Close mobile dropdown on click */ $('.sh-header-mobile-dropdown li.menu-item:not(.menu-item-has-children)').on( 'click', function() { if( $(this).find('> a').attr('href').indexOf("#") >= 0 ) { $('.sh-header-mobile .sh-nav-dropdown .c-hamburger').trigger('click').toggleClass('is-active'); } });
Hi @chavba,
I hope you are well today and thank you for your question.
To achieve this, you have to develop custom code in the custom plugin as shared below in the topics.
https://support.shufflehound.com/forums/topic/hide-mobile-menu-on-click/#post-5380
https://support.shufflehound.com/forums/topic/main-menu-on-mobile/#post-47622
Developing custom code for custom functionality is beyond the scope of support that we provide here. Please see https://themeforest.net/item/jevelin-multipurpose-premium-responsive-wordpress-theme/14728833/support
If you are not a developer then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Shufflehound recommends the developer https://www.upwork.com/freelancers/~011652ffec8865c6d5
Best regards,
Shufflehound team
Solution for this topic
Okay I resolved. If anyone has this problem here is my solution:
Edit wp-content/themes/jevelin/js/scripts.js file and add:
$( ‘.sh-nav-mobile li a’ ).on(“click”, function(){
$(‘.sh-header-builder-mobile-menu’).click();
});
Now the anchor navigation closes menu on click!
Awesome great to see you got that resolved.
Thanks for helping out here in this forum by sharing the solution.
Your help here is really appreciated.
Have a fantastic day!
Hello!
So how can i solve my same problem?
I add on script.js
$( ‘.sh-nav-mobile li a’ ).on(“click”, function(){
$(‘.sh-header-builder-mobile-menu’).click();
});
But doesn’t work. Where exactly i need to add this?
Thanks
@Bartopolo To help us keep support thread separates could you please create your own thread for your question instead of posting a reply on others thread as it makes the thread messy and hard to read.
If you want to you can also add a reference to this thread in your newly created thread.
We would be more than happy to help you with your new thread.
jQuery(document).ready(<span class=”__in”>function</span>($){
$( ‘.<span class=”__in”>sh</span>-<span class=”__in”>nav</span>-<span class=”__in”>mobile</span> <span class=”__in”>li</span> a’ ).on(“<span class=”__in”>click</span>”, <span class=”__in”>function</span>(){
$(‘.<span class=”__in”>sh</span>-<span class=”__in”>header</span>-<span class=”__in”>builder</span>-<span class=”__in”>mobile</span>-<span class=”__in”>menu</span>’).<span class=”__in”>click</span>();
});
});
I used this. Worked, but this for creative template wp bakery.
Dont know the code how works for unyson based headers in other templates..
@chavba As said above, to help us keep support thread separates could you please create your own thread for your question instead of posting a reply on others thread as it makes the thread messy and hard to read.
If you want to you can also add a reference to this thread in your newly created thread.
We would be more than happy to help you with your new thread.
it was my own thread, and was closed because i resolved previously…
@chavba Sorry for that.
I visited your shared website and saw it is working fine by closing the menu on mobile on clicking on menu item.
Could you please share the page URL from your site where it is not working so that I can troubleshoot it?
???? This problem was 4 months, 4 weeks ago.
Shufflehound support didnt help. I resolved and share the js lines that resolved the ANCHOR LINK mobile menu closing. You can’t see now the result because i removed anchor links.. but I shared the solution for others if someone wanna use anchor links onepage style and helping Shufflehound with the shared resolution..
Then bartopolo named user asked me about this, you or other moderator then asking him open new thread. I answered him then you or other moderator asked me repeatedly open new thread but previously bartopolo named use asked. Then now you again don’t understand the previous comments and asking ME where is the problem on my site while the site no longer use anchor linking in the mobile navbar anymore so you can’t understand the problem at all… let it go please.. It’s clear you don’t care and don’t want to understand and read back the situation or don’t know what does it mean when a mobile navbar should closing when the link do not redirecting to another page instead using just an onepage anchor link…
We have already developed and shared custom plugin solutions for the users long ago on the below topics but those solutions were not working for you and you developed your own solution and now again it is not working for you so we need to reproduce the issue somewhere to troubleshoot it, therefore, I have asked about it.
https://support.shufflehound.com/forums/topic/hide-mobile-menu-on-click/#post-5380
https://support.shufflehound.com/forums/topic/main-menu-on-mobile/#post-47622
As you have created custom header using WPbakery page builder, therefore, universal solution won’t work for you as markup will be different.