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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:46:20+00:00 2026-05-27T02:46:20+00:00

Here is an except of javascript. function showContent(layer, animate) { $(#background).show(); $(footer).hide(); $(#announcement).hide(); $(#content).html($(#

  • 0

Here is an except of javascript.

    function showContent(layer, animate) {

        $("#background").show();
        $("footer").hide();
        $("#announcement").hide();

        $("#content").html($("#" + layer + "_html").comments());

        $("nav").children().each(function() {
            if ($(this).attr("id").search(layer) == -1) {
                $(this).addClass("inactive");
            } else {
                $(this).removeClass("inactive");
            }
        });

        if (animate == true) {
            $('html,body').animate({scrollTop: $("nav").offset().top - 16 - 40}, 200, "swing");
        }

        // setUpHover();

        setupFullScreen();
        setupImageViewers();
        setupHovers();

        // Load analytics tracking
        setTimeout(function() {
            $("#tracker").attr("src", "/track/" + layer + "/")
        }, 500);

        window.location.hash = layer;
    }

    // Set up the on click functions for the different menus
    $("nav").children().click(function() {
        showContent($(this).attr("id").split("_")[1], true);
    });

Here is an excerpt of html:

http://pastie.org/2929494

Now here’s my question. With that js and html it does what it is suppose to. However when I add a needed div inside the nav as such it breaks:

http://pastie.org/2929497

I imagine the problem is in the original js above, there are two lines about (“nav”).children and imagine with my new code they are actually now grandchildren or such. So most likely need to make minor adjustments to both of those lines, but not sure to what.

Thanks in advance!

  • 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-27T02:46:21+00:00Added an answer on May 27, 2026 at 2:46 am

    I believe the line you’re asking about is :

    $("nav").children().click(function() {
    

    You could do:

    $("nav").children().children().click(function() {
    

    to get the “grand children”. However, I would probably use a class instead to make this a bit more resilient.

    $("nav").find(".navLink").click(function() {
    

    Where navLink is a class that you add to each of the elements which you want to be clickable.

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

Sidebar

Related Questions

My JavaScript is as follows: $.get(/<page>.php, userid='.$userid.'&+status, function(data){ $(#status).show(fast).html(data).delay(4000).hide(fast); }); I have many links
Here is my scenario. I'm am HTML/CSS guy, JavaScript not so much. But this
I have this function in my Javascript Code that updates html fields with their
Okay, first some background, I can't use any javascript library except YUI for this
I have a few classes which do nothing except in their constructors/destructors. Here's an
I have a control that contains a javascript function that is called on the
I have a script here, and it works amazing, except for one small detail.
I create a secondary browser window with Javascript code, using the window.open function, and
I'm making a typing tutor program using javascript. Everything is going well except that
I'm kind of stuck with this pretty simple (I'm sure) jQuery/Javascript issue. Here's the

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.