Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1170983
    Advasa
    Participant

    Hello

    I am using the top bar of a website for the business phone number and would like it to be sticky on mobile.
    How can I achieve this?

    Thanks

    Justin

    #1170985
    Advasa
    Participant
    This reply has been marked as private.
    #1171016
    Christopher
    Moderator

    Hi there,

    Please add following code in Customize -> Custom -> JavaScript :

    jQuery(document).ready(function($){
    	$(window).scroll(function(){
    		if ($(this).scrollTop() > 50) {
    			$('.x-topbar').addClass("x-navbar-fixed-top");
    		} else {
    			$('.x-topbar').removeClass("x-navbar-fixed-top");
    		}
    	});
    });

    Please add following code in Customize -> Custom -> CSS :

    .x-topbar.x-navbar-fixed-top{
    position:fixed;
    top:0;
    right:0;
    left:0;
    }

    Hope that helps.

    #1171159
    Advasa
    Participant

    Thank you that worked perfectly 🙂

    #1171171
    Thai
    Moderator

    Glad it worked 🙂

    If you need anything else please let us know.

    #1171253
    Advasa
    Participant

    Come to think of it how can I make the top bar sticky on all devices instead of just mobile??

    Thanks

    Justin

    #1171327
    Thai
    Moderator

    Hi Justin,

    Please also add the following CSS:

    .x-navbar.x-navbar-fixed-top {
        top: 51px;
    }

    Hope it helps 🙂

    #1171367
    Advasa
    Participant

    Thanks!

    #1171409
    Rahul
    Moderator

    You’re most welcome!

    Let us know if you have anything else to ask.

    Thanks for using the X theme!

    #1171430
    Advasa
    Participant

    Thank you

    How can I make the .x-icon-plus-circle that links the the header widget sticky on mobile as well?

    Cheers

    Justin

    #1171854
    Jade
    Moderator

    Hi Justin,

    You can add this under Custom > CSS in the Customizer.

    @media (max-width: 767px) {
        .x-widgetbar .x-widgetbar-inner {
            position: fixed;
        }
    }

    Hope this helps.

    #1172681
    Advasa
    Participant

    Hello

    I tried adding that code and it didn’t work, when I scroll down on mobile the image disappears.

    Thanks

    Justin

    #1172807
    Christopher
    Moderator

    Hi there,

    Please try this code :

    .x-btn-widgetbar {
        position: fixed;
    }

    Hope it helps.

    #1175649
    Advasa
    Participant

    Hello

    Thanks that made it sticky but when I slide the screen down it becomes unclickable.
    How can I fix this?

    Thanks

    Justin

    #1176078
    Lely
    Moderator

    Hello Justin,

    Please update above CSS to this:

    .x-btn-widgetbar {
        position: fixed;
        z-index:99999;
    }
    .x-widgetbar-inner {
        position: fixed;
    }

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1170983 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>