Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:51:28+00:00 2026-06-17T21:51:28+00:00

Well, I have this navigation menu which is static but I want to make

  • 0

Well, I have this navigation menu which is static but I want to make it flow smoothly whenever user scrolls his page down or up… Please help with the code because I already have tried to do something but everything went bad.

Code:

<div id="menu">

        <ul>

            <li class="page_item">

                <a href="<?php bloginfo('url'); ?>" title="Go home">Home</a>

            </li>

            <?php wp_list_pages('&title_li=&exclude=6386'); ?>

            <?php

            if(is_user_logged_in() && !current_user_can('subscriber')) :

            ?>

            <li class="page_item">

                <a href="<?php bloginfo('url'); ?>/tasks/" title="Your task list">Tasks</a>

            </li>

            <?php

            endif;

            ?>

            <?php

            if(!is_user_logged_in()) :

            ?>

            <li class="page_item">

                <a href="<?php bloginfo('url'); ?>/wp-admin/">Log in</a>

            </li>

            <?php

            endif;

            ?>

        </ul>

    </div>

I want this whole thing to float, how am I supposed to do this?

I tried to add this script and give menu class=”scroller”:

$(window).load(function(){
$(window).scroll(function(){
    if($(window).scrollTop()>60){
        $('.scroller').css('position', 'fixed');
        $('.scroller').css('top', 0);
    } else {
        $('.scroller').css('position', 'relative');
        $('.scroller').css('top', 60);
    }
});

});

But no luck..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:51:29+00:00Added an answer on June 17, 2026 at 9:51 pm

    First of all, because you’re using jQuery, you don’t have to bind the onLoad event to do it. Just bind the onDomReady pseudo-event, without to create any other class (you already have the ID). That said, you need to listen for the onScroll event of the document. Try this:

    $(function(){
        $(document).on('scroll',function(){
            var $this = $(this),
                $menu = $('#menu'),
                scrl = $this.scrollTop(),
                menuHeight = $menu.height();
    
            if( scrl > menuHeight ) {
                $('#menu').css({
                    'position': 'fixed',
                    'top': 0
                });
            } else {
                $('#menu').css({
                    'position': 'relative',
                    'top': menuHeight
                });
            }
        });
    });
    

    This should works fine for your needs.

    Here’s a jsFiddle to test the code.

    EDIT: code updated to dynamically handle every menu height.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this routine that works well, but it messes up as it counts
Well I have this code which is fairly simple and should set margin-top of
I have a model that looks like this (well not really but it has
I have a menu with sub-menu child navigation as well, and I'm trying to
Well I have this code in my Managed C++/Cli in Visual Studio 2008, I
Well currently I have this: <rich:fileUpload addLabel=Agregar clearAllLabel=Quitar todos clearLabel=Quitar deleteLabel=Quitar doneLabel=Completado uploadLabel=Subir archivos
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have this linq query that works well (although it may be written better,
I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
Well this is weird let me describe the scenario I have this mailer define

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.