Navigation bar fixed.

Solved
akarl
New Member
10 0 0

Hello,  

I am working on the Supply theme and want to have the navigation bar fixed during scrolling down from the PC monitor (from the mobile is working fine). 

 

PS. The previous post did not solve this issue.

 

Pls assist.

Thank you

 

 

Accepted Solution (1)

Accepted Solutions
Jasoliya
Shopify Expert
4382 574 1105

This is an accepted solution.

Hi @akarl 

You can follow this code:

As you have added code of sandip but that's code has issue and i have solved, so add this:

Add this code in Theme.js

$(window).scroll(function(){
    var navigationPosition = $('.site-header').outerHeight();
    if($(window).scrollTop()>=navigationPosition){
        $('body').addClass('sticky-nav');
    }else {
        $('body').removeClass('sticky-nav');
    }
});

Add in Theme.scss file at bottom

@media only screen and (min-width: 767px) {.sticky-nav nav#navBar {position: fixed;top: 0;bottom: auto;z-index: 5;}}
Want to modify or custom changes on store hire me.
Want to convert visitor to buyers ? try This app.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here

View solution in original post

Replies 28 (28)
Tejas_Nadpara
Shopify Partner
1034 215 518

@akarl 

 

Share your store url so, I can take a look and assist you better.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
Sandip
Shopify Expert
45 2 7

Hey @akarl 

 

Please add this script in your js file.

<script>

$(window).scroll(function(){
var navigationPosition = $('#navBar').offset().top;
if($(this).scrollTop()>=navigationPosition){
$('body').addClass('sticky-nav');
}else {
$('body').removeClass('sticky-nav');
}
});

</script>

and apply CSS based on this class.

<style>

.sticky-nav nav#navBar {
position: fixed;
top: 0;
bottom: auto;
z-index: 99;
Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: info@plusinfosys.in
Skype: ramani.sandip948
akarl
New Member
10 0 0

Hi Tejas,

 

Pls find below my web site and kindly have a look.

https://jewelry-oustamp.myshopify.com/

 

Thanks

 

akarl
New Member
10 0 0

 

 

Sandip
Shopify Expert
45 2 7

Hey @akarl 

Can you please share front password 

So we can check and let you know

 

Thanks!

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: info@plusinfosys.in
Skype: ramani.sandip948
akarl
New Member
10 0 0

pwd:sewcri

 

Pls have a look when convenience.

 

Thank you

Jasoliya
Shopify Expert
4382 574 1105

This is an accepted solution.

Hi @akarl 

You can follow this code:

As you have added code of sandip but that's code has issue and i have solved, so add this:

Add this code in Theme.js

$(window).scroll(function(){
    var navigationPosition = $('.site-header').outerHeight();
    if($(window).scrollTop()>=navigationPosition){
        $('body').addClass('sticky-nav');
    }else {
        $('body').removeClass('sticky-nav');
    }
});

Add in Theme.scss file at bottom

@media only screen and (min-width: 767px) {.sticky-nav nav#navBar {position: fixed;top: 0;bottom: auto;z-index: 5;}}
Want to modify or custom changes on store hire me.
Want to convert visitor to buyers ? try This app.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here

View solution in original post

akarl
New Member
10 0 0

Thank you very much for your time to solve the problem.

Now is working perfectly.

 

Thank you

elizsia
Tourist
29 0 1
.site-nav{ position: fixed !important; top: 140px !important; right: 200px !important; z-index: 1 !important; } #PageContainer{ margin-top: 75px !important; }