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

  • SEARCH
  • Home
  • 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 8314675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:54:02+00:00 2026-06-08T20:54:02+00:00

Basically I have an unordered list acting as my navigation on a one page

  • 0

Basically I have an unordered list acting as my navigation on a one page website sorted by sections. These sections or panels are full width and height of the browser window.

In the first panel, this list is vertical but when the user scrolls down the page to section two (i.e. the second panel from the top of the browser window) I’d like to change the style of it so that it fixes to the top of the browser window and becomes a horizontal nav instead of a vertical one. I don’t want to duplicate the list if possible.

I’m not great at jQuery and don’t really know where to start. Any help would be great.

This is my current code that gets the width and height of the browser window and displays a full screen div:

function fitElements(){
var height=$(window).height();
var width=$(window).width();
$('.panel').css('height',height);
$('.panel').css('width',width)
};
  • 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-08T20:54:04+00:00Added an answer on June 8, 2026 at 8:54 pm

    Here’s a very simple example:

    DEMO

    html:

    <ul id="nav">
    <li><a href="#" id="linkOne">One</a></li>
    <li><a href="#" id="linkTwo">Two</a></li>
    <li><a href="#" id="linkThree">Three</a></li>
    </ul>
    
    <div id="divOne" class="panel">    
    </div>
    <div id="divTwo" class="panel">    
    </div>
    <div id="divThree" class="panel">    
    </div>
    

    css:

    #nav {
     position:fixed;
     top:0;
     left:10px;     
    }
    
    #nav.horizontal li {
      float:left;
    }
    
    #divOne {
     background-color:#cef;   
    }
    #divTwo{
     background-color:#efc;   
    }
    #divThree{
     background-color:#fce;   
    }
    

    ​
    js/jQuery:

    $("div.panel").css({
        height: $(window).height(),
        width: $(window).width()
    });
    
    $(window).scroll(function() {
        ($("#divTwo").offset().top <= window.pageYOffset) ? $("#nav").addClass("horizontal") : $("#nav").removeClass("horizontal");
    });
    
    $("#linkOne").click(function(e){
       $('html, body').animate({
            scrollTop: $("#divOne").offset().top
        });
        $("#nav").removeClass("horizontal");
        e.preventDefault();
    });
    
    $("#linkTwo").click(function(e){
       $('html, body').animate({
            scrollTop: $("#divTwo").offset().top
        });
        $("#nav").addClass("horizontal");
        e.preventDefault();
    });
    
    $("#linkThree").click(function(e){
       $('html, body').animate({
            scrollTop: $("#divThree").offset().top
        });
        $("#nav").addClass("horizontal");
        e.preventDefault();
    });
    

    ​

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

Sidebar

Related Questions

i have a page which is basically just a big unordered list - sort
I basically have a fixed width DIV with an unordered list inside that overflows
I basically have a program that filters records from one excel file to another
I'm basically having a bit of trouble with traversing through an unordered list and
Okay, Now I have an unordered list here: <ul id="mycustomid"> <li><a href="url of Item
Basically what I have here is a button that adds a new list item
Is it possible to have Wordpress generate this type of unordered list? <ul id=nav1>
Basically I have 2 buttons that when hovered show/hide 2 hidden unordered lists so
I basically have a layout like this: <body> <div style=height: 150px; width: 200px; background:
I have a script that turns an unordered list of images into a horizontal

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.