• Resolved gabbyeebeckford

    (@gabbyeebeckford)


    How do I get a sticky navigation bar in dazzle wordpress theme so that when I scroll down I wont have to scroll all the way back up to get to navigation bar? I would prefer if the sticky nav bar could work in both desktop and mobile views. My website is lightyourfireisland.com

    Thanks in advance for any help

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter gabbyeebeckford

    (@gabbyeebeckford)

    My website is lightyourfireisland.com I found Mystickymenu plugin and it worked for making the nav bar remain floating/sticky at the top of the page in desktop view but not for mobile view.
    I also used WP Touch which allows mobile users to view a customized mobile site. I tried adding a custom CSS code thingy to it and it still doesn’t float. Any suggestions?

    Hi @gabbyeebeckford,

    I hope you are well today and thank you for your question.

    You can try achieving this by downloading the plugin attached to the following reply

    https://colorlib.com/wp/forums/topic/fixed-header-on-every-page/#post-37757

    and then change the code in its file colorlib-plugin.php as following.

    <?php
    /*
    Plugin Name: Colorlib Plugin
    Description: Quick Custom Solution Plugin for Implementing Custom Solution.
    Version: 1.0.0
    Author: Movin
    Author URI: https://freewptp.com/
    License: GNU General Public License (Version 2 - GPLv2)
    */
    
    function add_custom_scripts(){
        if( ! wp_is_mobile() ) {
        ?>
    	<script type="text/javascript">
    		jQuery("document").ready(function($){
    
                    var nav = $('.navbar-default .navbar-collapse');
                    var con_height = $('.navbar-default .navbar-collapse').height();
                    $(window).scroll(function () {
                        if ($(this).scrollTop() > con_height) {
                            nav.addClass("f-nav");
                        } else {
                            nav.removeClass("f-nav");
                        }
                    });
    
                });
    	</script>
            <style>
            .navbar-default .navbar-collapse.f-nav {
                position: fixed;
                top: 0px;
                z-index: 9999;
                width: 100%;
                max-width: 1154px;
                background: #474747;
                margin: 0;
            }
            </style>
    <?php }
    }
    add_action('wp_footer', 'add_custom_scripts', 99);

    Best Regards,
    Movin

    Thread Starter gabbyeebeckford

    (@gabbyeebeckford)

    Hey @free WP TP I cannot find a colorlib-plugin.php
    Is there something else I should add this to?

    Thread Starter gabbyeebeckford

    (@gabbyeebeckford)

    nevermind lol. Stand-by I’ll try this out again

    Thread Starter gabbyeebeckford

    (@gabbyeebeckford)

    Ok so I think I added the plugin because i was able to activate it. however the navigation bar is still not fixed when I view in mobile.I am still using wptouch plugin btw.

    You are most welcome ??

    The navigation bar is not fixed when viewed on mobile because on mobile devices the responsive navigation menu is displayed and it’s not necessary to make it fixed so this functionality is skipped in the provided code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I get a sticky navigation bar in dazzle wordpress theme’ is closed to new replies.