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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:07:38+00:00 2026-06-11T11:07:38+00:00

I actually didn’t really know how to phrase the question title, but here is

  • 0

I actually didn’t really know how to phrase the question title, but here is the description. Suppose I’m using jQuery to show/hide uls that are stacked on top of each other (absolutely positioned). For example:

<ul id="one">
  <li>blah</li>
  <li>blah2</li>
</ul>

<ul id="two">
  <li>blah</li>
  <li>blah2</li>
</ul>

I have a controller button, that when pressed, simply changes the z-index of these uls. The controller button is literally just:

<a href="#" id="mybutton">My button</a>

With jQuery code that does: (I’m using the jQuery cycle plugin)

$('#mybutton').click(function() { 
  // check which ul is currently shown
  // change z-index, so that the next ul is to be shown
});

THE QUESTION:

In my site, I have several pages that I would like to point to the second ul, so that when clicked, it’ll bring them to the page with all of the uls, but only the second one will be shown. It would be the same if the person went to the page, had the default first ul shown, and then clicked “next” to proceed to the next ul. I am simply wondering if it’s possible to avoid pressing “next”, and just bring the user directly to the page and have the second ul shown.

  • 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-11T11:07:39+00:00Added an answer on June 11, 2026 at 11:07 am

    I think you can use the hash-tag from the URL. You can then write an if statement like this:

     if(location.hash === "#2"){
         $("#one").hide();
     }else{
         $("#two").hide();
     }
    

    Or directly as a copy and paste example:

    <html>
    <script src="http:////ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    <script>
    $(function(){
        if(location.hash === "#2"){
            $("#one").hide();
        }else{
            $("#two").hide();
        }
        $('#mybutton').click(function(e) { 
            $("ul").toggle(); //quick n dirty! only works with 2 lists :)
            e.preventDefault();
        });
    });
    </script>
    <body>
    <a href="#" id="mybutton">My button</a>
    
    <ul id="one">
      <li>First Item!</li>
      <li>blah</li>
      <li>blah2</li>
    </ul>
    
    <ul id="two">
      <li>Second Item!</li>
      <li>blah</li>
      <li>blah2</li>
    </ul>
    
    <a href="#2">To second page (you might have to refresh, notice the #2 at the end of the url!)</a>
    ​</body>
    </html>
    

    Also notice I’ve inserted a e.preventDefault(); at #mybutton‘s click listener to prevent the URL changing back on clicking.

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

Sidebar

Related Questions

The title may sound confusing but it actually isn't, I just didn't know how
I saw some results via the related questions but didn't actually seem to show
I've already asked a related question, but sadly the answers, whilst correct, didn't actually
I'm actually reposting a question from the iphone development boards. I didn't ask it,
I'm reading a tutorial for C++ but it didn't actually give me a difference
I didn't actually able to come up with the best suitable title for this.
I have a question actually I didn't understand something about child and parent processes.When
Actually I am new to jquery as well as web designing Now I need
Actually I am working on this for the last 3 or 4 weeks but
Actually i want that, suppose i have a colorcode #FF3366. How can i examine

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.