muynck Posted August 1, 2015 Share Posted August 1, 2015 Hi developers, I learn a lot from this forum because people share, so now I want to share a little script for those in need. For the default theme I have written a few lines of JavaScript (jQuery if you want) to make the menu sticky (only on wide screens). With it comes some CSS. This code is tested with PrestaShop 1.6.0.11. If you have suggestions for other version, please comment. JavaScript (jQuery)Starting from line 38 in themes/default-bootstrap/js/modules/blocktopmenu/js/blocktopmenu.js add this: $(document).on('ready',function(){ if($(document).width()>767){ $(document).on('ready scroll',function(){ if($(document).scrollTop()>165) { $("#block_top_menu").addClass('sticked-container'); $(".sf-menu").addClass('sticked-menu'); $('.sf-search').show(); } else { $("#block_top_menu").removeClass('sticked-container'); $(".sf-menu").removeClass('sticked-menu'); $('.sf-search').hide(); } }); } }); I disabled it for smalls screens because I consider a sticky menu annoying on smalls screens.CSSAt the end in themes/default-bootstrap/css/modules/blocktopmenu/css/superfish-modified.css add this: .sticked-container { position: fixed; top: 0px; padding: 0px!important; left: 0px; background: #085DA5; } .sticked-menu { max-width: 1170px; margin:0 auto; } .sticked-menu.sf-menu > li > a { border-bottom:0px solid transparent; padding: 18px 9px; } You can play some with the padding, maybe it doesn't work with the changes you already made. Also, color the background to your preference. 2 Link to comment Share on other sites More sharing options...
shaft Posted August 23, 2015 Share Posted August 23, 2015 Hello, thank you for this tutorial. It WORKS very good! ;-) Prestashop v 1.6.0.14. PS: Do you know, how to get a image "cart" in clickable link to "cart" in scroll down menu. Just like in a image bellow? :-) Link to comment Share on other sites More sharing options...
Juanan13 Posted September 29, 2017 Share Posted September 29, 2017 Great, thanks a lot !! Works in presta 1.6.1.17 too. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now