How can I make a menubar fixed on the top while scrolling



How can I make a menubar fixed on the top while scrolling ?

menubar-fixied.png

Plese PM the url to you website and i will post the code





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

Hello meetshamee!



Please, have a look at this add-on [url=“http://www.alt-team.com/cs-cart-floating-blocks-add-on.html”]http://www.alt-team.com/cs-cart-floating-blocks-add-on.html[/url] I think it is what you are looking for.



Best regards, Alt-team

[url=“Dynamic Top Menu Positioning - JSFiddle - Code Playground”]http://jsfiddle.net/adamb/F4BmP/[/url]



this will be so helpful to implement.

Ok I will post a perfect solution now. I was working for my client recently.



Just Write



custom css


.sticky {
position: fixed;
/* width: 100%; */
margin: 0 auto;
left: 20%;
top: 0;
z-index: 100;
border-top: 0;
width: 960px;
}


when using full width remove 960px and activate 100%

and create script.post.tpl in hook index folder



and past the following script


```php


```



Dont forget to apply top-menu css class to menu block in design block mode under user css class.





It was tested in version 4.0.2 and works fine .





Let me know your thoughts …

[quote name='ravt' timestamp='1382711550' post='170375']

Ok I will post a perfect solution now. I was working for my client recently.



Just Write



custom css


.sticky {
position: fixed;
/* width: 100%; */
margin: 0 auto;
left: 20%;
top: 0;
z-index: 100;
border-top: 0;
width: 960px;
}


when using full width remove 960px and activate 100%

and create script.post.tpl in hook index folder



and past the following script


```php


```



Dont forget to apply top-menu css class to menu block in design block mode under user css class.





It was tested in version 4.0.2 and works fine .





Let me know your thoughts …

[/quote]



Will this code still work in 4.03? I am trying but it is doing nothing.

[quote name='Vali' timestamp='1375858147' post='166408']

Plese PM the url to you website and i will post the code





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

[/quote]



Any chance of you knowing how to accomplish this in v4.03?

I tried to use this in conjunction with my_changes addon (I think this it the folder you are refaring hooks/index)



In 4.03 I couldn't make it work.

I applied this change in Version 4.0.3 and it works good.



did you follow the steps?



RR

Not working on 4.2.2

[quote name='NaMo' timestamp='1412258526' post='193289']

Not working on 4.2.2

[/quote]



For this version, change “.top-menu” in the sample script to “.tygh-header”, and set the width in the CSS example to 100% instead of 960px.



This will make the header sticky as-is. You may want to make CSS changes to its appearance by targeting items with .sticky



Hope that helps!

Free Fixed/Sticky Menu Add-on for CS-Cart 4: http://www.cscart-templates-addons.com/fixed-menu-on-scroll/