Home › Forums › Tucson – Responsive HTML5 Template › How to set a menu as sticky in mobile
- This topic has 7 replies, 2 voices, and was last updated 7 years, 7 months ago by
SSANG COOL. This post has been viewed 3312 times
-
AuthorPosts
-
June 18, 2018 at 12:09 am #10026584
SSANG COOL
ParticipantHi team,
Can I ask you something? For desktop, main menu is sticky when we scroll down, but for mobile, hamburger menu is not sticky. How should we set a hamburger menu as sticky for mobile (phone and tablet)?
Thanks,
SSANG
June 19, 2018 at 5:05 am #10026595Support
KeymasterHello,
To do that, just add the code below in (js/custom.js):
$.extend(theme.StickyMenu.defaults, { stickyEnableOnMobile: true });Please try that and let me know if you need further assistance.
Kind Regards,
Rodrigo
-
This reply was modified 7 years, 7 months ago by
Support.
June 19, 2018 at 10:41 pm #10026609SSANG COOL
ParticipantHi Rodrigo,
Thank you so much for your quick workaround. It works!!!
Regards,
SSANG
June 20, 2018 at 12:10 am #10026611SSANG COOL
ParticipantThis reply has been marked as private.June 20, 2018 at 5:52 am #10026619Support
KeymasterHello Sang,
1) Just add the code below in (css/custom.css):
#header { padding: 10px 0px !important; } #header .logo { padding-bottom: 10px !important; padding-top: 10px; } .logo img { width: auto !important; height: auto !important; } body.sticky-menu-active #header { top: 0; } @media(max-width: 991px) { .btn-responsive-nav { margin-top: -7px; } }2) Tucson doesn’t come this functionality by default, but you can easily add with the code below at (js/custom.js):
$(window).on('click touchend', function(e){ var target = e.target; if( !target.closest('#header') ) { $('.nav-main-collapse').collapse('hide'); } });Please, try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
June 20, 2018 at 11:35 pm #10026634SSANG COOL
ParticipantThis reply has been marked as private.June 21, 2018 at 9:13 pm #10026654Support
KeymasterHello Sang,
1) Change the JS code to:
var flag = false; $('.btn-responsive-nav').on('click', function(){ if( !flag ) { $(window).on('click touchend', function(e){ var target = e.target; if( !target.closest('#header') ) { $('.nav-main-collapse').collapse('hide'); } }); } flag = true; });2) Sorry but unfortunately this feature isn’t with fixed menus (that is the case of sticky menu on mobile).
Kind Regards,
Rodrigo.
June 22, 2018 at 8:38 am #10026674SSANG COOL
ParticipantThis reply has been marked as private. -
This reply was modified 7 years, 7 months ago by
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.
