Page 1 of 1

Sticky menu with checkout and my account

Posted: Fri Dec 28, 2018 10:03 pm
by dani888
Hello everyone
What do I have to add to this code?
sticky menu and stay on top with the search button and shopping cart
The cod is
$(function(){
var div = '#m-menu';
var windowScrollTop = $(window).scrollTop();
var divOffsetTop = $(div).offset().top;
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}

$(window).on('scroll', function(){
var windowScrollTop = $(window).scrollTop();
if(windowScrollTop > divOffsetTop){
$(div).addClass('sticky');
} else {
$(div).removeClass('sticky');
}
});
});
And Css code
#m-menu.sticky {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 999999;
}
I use this menu module
https://www.opencart.com/index.php?rout ... ega%20menu
So I want to show the sticky menu
http://prntscr.com/m0mcxl
The theme http://www.spearthemes.com/oc-light/
Opencart 3.0.2.0
Now it just works like this
http://prntscr.com/m0mekz

If it can be done sticky menu with header
Thank you

Re: Sticky menu with checkout and my account

Posted: Fri Dec 28, 2018 10:42 pm
by xxvirusxx
viewtopic.php?t=206927

LE: Install this extension (to edit ocmod files)
https://www.opencart.com/index.php?rout ... n_id=22318

And changes from converted ocmod (top link) and change <body class="{{ class }}"> to <body>

Re: Sticky menu with checkout and my account

Posted: Fri Dec 28, 2018 11:25 pm
by dani888

Re: Sticky menu with checkout and my account

Posted: Fri Dec 28, 2018 11:36 pm
by xxvirusxx
Because you don't have installed from Extensions->Modules....

Re: Sticky menu with checkout and my account

Posted: Sat Dec 29, 2018 2:36 am
by dani888
I installed the module
But the module does not go with the fixed header menu

This javascript code works
viewtopic.php?t=203250
but you also need to add the top part
Maybe someone knows what to add to the javascript code to work with the header
Thank you

Re: Sticky menu with checkout and my account

Posted: Sat Dec 29, 2018 3:49 pm
by xxvirusxx
Converted extension work just fine on that theme with default menu.
And because Mega Menu is a paid module that converted extension can't be tested

Re: Sticky menu with checkout and my account

Posted: Sat Dec 29, 2018 6:09 pm
by dani888
Hello
Okay, it works
Thanks for your help

Re: Sticky menu with checkout and my account

Posted: Sun Dec 30, 2018 1:58 am
by dani888
Hello
Now it works with my menu
http://prntscr.com/m12e1d
I deleted a bracket and it does not work
Thanks for your help
Happy New Year