• Resolved morleyj.

    (@morleyj)


    Sorry if the topic already exists. I am trying to avoid the top navigation bar to scroll. I’ve tried a plug in and it worked, aside for the nav-bar shadow that remained fixed and it was not nice.
    Thank you so much in advance.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Theme Author Richie KS

    (@rkcorp)

    add this to theme option->custom css

    #top-navigation:before,#top-navigation:after {display:none;}

    Thread Starter morleyj.

    (@morleyj)

    Thank you so much for your quick answer but sadly it doesn’t work. ??

    Theme Author Richie KS

    (@rkcorp)

    it work on my end tho, the shadow disappear once i added the code. try clearing your site cache etc..

    recheck the css code
    #top-navigation:before, #top-navigation:after { display:none; }

    Thread Starter morleyj.

    (@morleyj)

    I don’t know what I am doing wrong, but the only thing I got is that the shadow disappear.
    Probably I am not able to clear the cache appropriately.

    Theme Author Richie KS

    (@rkcorp)

    yes, the code only make the shadow disappear.
    you said that you already use plugin for sticky navigation.

    the theme itself did not have sticky navigation.

    Thread Starter morleyj.

    (@morleyj)

    Yes i’ve tried to use the plugin but it doesn’t run, so I deleted it.
    I give up. No problem. Thank you for your kind attention.

    Theme Author Richie KS

    (@rkcorp)

    actually you could, add this to wp-content/meso-custom-functions.php or your child theme functions.php

    <?php
    /*--------------------------------------------
    Description: add mesocolumn sticky nav
    ---------------------------------------------*/
    function meso_add_sticky_nav() {
    if( !wp_is_mobile() ) {
    if( is_user_logged_in() ) { $log = 'true'; } else { $log = 'false'; } ?>
    <script type="text/javascript">
    jQuery.noConflict();
    var $st = jQuery;
    var log = <?php echo "$log"; ?>;
    $st(document).ready(function() {
    // grab the initial top offset of the navigation
    var sticky_navigation_offset_top = $st('#top-navigation').offset().top;
    // our function that decides weather the navigation bar should have "fixed" css position or not.
    var sticky_navigation = function(){
    var scroll_top = $st(window).scrollTop();
            if (scroll_top > sticky_navigation_offset_top) {
            if( log == true ) {
            $st('#top-navigation').css({ 'z-index': '9999','position': 'fixed','top':30, 'left':0 });
            } else {
            $st('#top-navigation').css({ 'z-index': '9999','position': 'fixed','top':0, 'left':0 });
            }
            $st('#top-navigation').addClass('iegradient topping');
    
    		} else {
    		   $st('#top-navigation').css({ 'position': 'relative', 'top':0 });
               $st('#top-navigation').removeClass('topping');
    		}
    	};
    	// run our function on load
    	sticky_navigation();
    	$st(window).scroll(function() {
    		 sticky_navigation();
    	});
    	$st('a[href="#"]').click(function(event){
    		event.preventDefault();
    	});
    
    });
    </script>
    <style>#top-navigation:before,#top-navigation:after{display:none;}</style>
    <?php } }
    add_action('wp_head','meso_add_sticky_nav',99);
    ?>
    Thread Starter morleyj.

    (@morleyj)

    I thank you again, unfortunately I am pretty noob in code and site building and I can’t find the folder you say.
    Thank you anyway I appreciate so much your help and your work, bye ??

    Theme Author Richie KS

    (@rkcorp)

    check the faq.txt on how to create new file in wp-content/ name it meso-custom-functions.php.

    or you could just paste it in functions.php without the <?php and closing ?>

    Thread Starter morleyj.

    (@morleyj)

    tried the second one
    tragedy

    Parse error: syntax error, unexpected ‘}’ in /web/htdocs/www.fieralibroiglesias.it/home/wp-content/themes/mesocolumn/functions.php on line 470

    Theme Author Richie KS

    (@rkcorp)

    seem fine to me with the same code.

    menu isn’t responsive at all, after applying these changes in function.php

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Sticky top navigation bar’ is closed to new replies.