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 6737363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:14:24+00:00 2026-05-26T11:14:24+00:00

I am building a responsive menu that scales dependent on screen size. i need

  • 0

I am building a responsive menu that scales dependent on screen size. i need to hide some li’s and rearrange another when the screen size changes, then when the screen size is resized back to its original size all elements need to revert back to the way they where.

I kinda got it working when I resize the window, but I’m batteling to get it back to its original state

this is my code:

**HTML***

<nav id="main-nav">
        <ul class="menu">
            <li class="login-mobile mobile"><a class="login" href="">login</a></li>
            <li class="signup-mobile mobile"><a class="signup" href="">sign up</a></li>
            <li class="shop-mobile mobile"><a class="shop" href="">shop</a></li>
            <li ><a class="home" href="">home</a></li>
            <li ><a class="about" href="">about</a></li>
            <li ><a class="promo" href="">promo</a>
                <ul class="submenu">
                    <li><a href="">Apple - Free Wi-Fi P</a></li>
                    <li><a href="">Lanseria - FREE Wi-Fi </a></li>
                    <li><a href="">BlackBerry PlayBook</a></li>
                </ul>
            </li>
            <li ><a class="services" href="">services</a></li>
            <li ><a class="tools" href="">tools</a></li>
            <li ><a class="converge" href="">converge</a></li>
            <li ><a class="news" href="">news</a></li>
            <li ><a class="contact" href="">contact</a></li>
            <li class="darkblue_grad"><a class="help" href="">help</a></li>
        </ul>
    </nav>

**jQuery**

function menuOrder(){

 if ($(window).width() > 590) {
    $("nav#main-nav ul.menu li.login-mobile, nav#main-nav ul.menu li.signup-mobile").hide();
var mobile = $("nav#main-nav ul.menu > li.shop-mobile");
mobile.appendTo(mobile.parent("ul.menu")).end();

} else{
    $("nav#main-nav ul.menu li.login-mobile, nav#main-nav ul.menu li.signup-mobile").show();

}

}

$(document).ready(function(){

    menuOrder();

    $(window).resize(function() {

        menuOrder();
    });

});

  • 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-05-26T11:14:25+00:00Added an answer on May 26, 2026 at 11:14 am

    Why not stash the innerHTML of your menu in a variable at load time, then just write it back onto the DOM when you need a fresh copy. No need to “un-do” anything this way.

    EDIT:

    capture the original menu (do this before manipulating it, when the page loads):

    var originalMenu = $('#main-nav').html()
    

    write-back the original menu:

    $('#main-nav').html(originalMenu)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building the same project (without any changes) produces binary different exe-files: some small regions
In building my responsive website I have come across a bug that appears only
I'm starting off building a site which should be responsive to different screen sizes.
I'm building an iphone application that will need to communicate and exchange data with
I'm building an SMS call and response system in a new app that receives
I got some weird error with response.redirect() and the project wasn't building at all..
building a site using PHP and MySQL that needs to store a lot of
Building a website that has English & Japanese speaking users, with the Japanese users
I'm building some web apps for clients. They're usually CRMs, project management systems, custom
I am building a trading portfolio management system that is responsible for production, optimization,

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.