• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How reduce the width of a sticky menu-bar?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How reduce the width of a sticky menu-bar?

This topic is: resolved

Tagged: menu-bar-width, sticky meny-bar

  • This topic has 2 replies, 1 voice, and was last updated 8 years, 5 months ago by Dan-cer.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 26, 2017 at 6:01 am #200052
    Dan-cer
    Member

    Hi,
    I followed the tutorial http://my.studiopress.com/tutorials/sticky-menu/ and it is working most.
    As the site has a boxed-layout of max-width: 1200px, the sticky menu should also have this width.
    Actually the menu has full-width of screen.

    I took this css-code from the tutorial:

     .nav-secondary {
    	background-color: rgba(0,0,0,0.5);
    	color: #fff;
    	font-size: 16px;
    	display: none;
    	position: fixed;
    	width: 100%;
    	z-index: 999;
    }

    How can I change the width now? I invested the elements live, but can't get the right code for it.

    https://official.jungvital.com
    February 3, 2017 at 10:48 am #200514
    Dan-cer
    Member

    I got an answer at http://wordpress.stackexchange.com:

    "You have another div controlling the full width background. You need to alter the css of that one if you want the width to look. This css takes the background off the full width div you have and put the background on the wrap div that you have maxing at 1200px;"

    .lifestyle-pro-blue .nav-secondary {background:none;} .wrap{background-color:rgba(0,0,0,0.5);}

    This works!

    February 5, 2017 at 8:47 am #200582
    Dan-cer
    Member

    That was not yet the best solution. I got another script using the nav-primary-menu bar.

    jQuery(function( $ ){
    	$(window).scroll(function() {
    		var yPos = $(window).scrollTop();
    		if(yPos > 200) { // show sticky menu after screen has scrolled down 200px from the top
    			$(".nav-primary").addClass('sticky-nav');
    		} else {
    			$(".nav-primary").removeClass('sticky-nav');
    		}
    	});
    });
    
    /* CSS (kein Leerzeichen zwischen .nav-primary und .sticky!):
    
    .nav-primary.sticky {
    	background: none;
    	position: fixed;
    	width: 100%;
    	left: 0;
    	z-index: 999;
    }
    
    .nav-primary.sticky .wrap {
    	background-color: rgba(0, 0, 0, 0.5);
    }
    
    */
    
    /*Function
    //* Enqueue sticky menu script
    add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' );
    function custom_enqueue_script() {
    	wp_enqueue_script( 'sticky-menu', get_stylesheet_directory_uri() . '/js/sticky-menu.js', array( 'jquery' ), '', true );
    }
    //* Reposition the secondary navigation menu
    
    remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble